相关疑难解决方法(0)

处理webview中的链接

WebView在webview中加载了所有链接 - 但是当我选择一个电子邮件链接时,它会尝试在webview中加载它而不是在手机上启动电子邮件应用程序.我该如何解决?链接是mailto://someone@somewhere.com

这是我的代码 - 它WebView本身正常工作,所有内容都在webview中加载,包括mailto:等.需要mailto链接加载到其他地方

package com.apps.jerdog.crcc;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebView;
import android.webkit.WebViewClient;

@SuppressWarnings("unused")
public class mainActivity extends Activity {
    /** Called when the activity is first created. */
    /**@Override */
    WebView webview;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        webview = (WebView) findViewById(R.id.webview);
        webview.getSettings().setJavaScriptEnabled(true);
        webview.getSettings().setSupportZoom(true);
        webview.getSettings().setBuiltInZoomControls(true);
        webview.setWebViewClient(new WebViewClient());
        webview.loadUrl("http://www.cedarridge.cc");
        }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()) {
            webview.goBack(); …
Run Code Online (Sandbox Code Playgroud)

android android-webview

36
推荐指数
2
解决办法
5万
查看次数

Android webview"location.replace"不起作用

我有一个Android webview,其页面重定向到另一个页面,使用location.replace(url).
让我们说我有页面"A"重定向到页面"B"(使用location.replace).当从页面"B"按下"后退"按钮时,页面返回页面"A",再次将其重定向到页面"B".当我调试历史api(history.length)时,我可以清楚地看到页面"B"的长度增加了"1"(仅在Android 4.X webview上.在iOS /网络浏览器/ Android 2.X上保持不变),这是一个错误!(location.replace不应该改变history.lenght!)

javascript android android-webview html5-history

2
推荐指数
2
解决办法
5406
查看次数