链接无法在Android N webview中正确加载

时间:2017-04-13 09:30:58

标签: android webview

我希望使用webview打开此链接(http://e-sign-poc.s3-website-us-west-2.amazonaws.com/),例如移动浏览器

mWebview = (WebView) findViewById(R.id.wb_sample);
WebSettings webSettings = mWebview.getSettings(); webSettings.setJavaScriptEnabled(true);
mWebview.setWebChromeClient(new WebChromeClient());
mWebview.setWebViewClient(new WebViewClient());
mWebview.loadUrl("http://e-sign-poc.s3-website-us-west-2.amazonaws.com/");

此链接未在webview中正确加载,但此链接在电报webview中完美运行

2 个答案:

答案 0 :(得分:0)

将网址加载到WebView后等待一段时间

它将在我的设备中完美运行

尝试使用此代码

 url = "http://e-sign-poc.s3-website-us-west-2.amazonaws.com/" +
            "";
    linearLayout.setVisibility(View.GONE);
    webView.setVisibility(View.VISIBLE);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setSupportZoom(true);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.loadUrl(url);

答案 1 :(得分:0)

尝试使用它 -

 webView = (WebView) findViewById(R.id.wvTest);
        progressBar = (ProgressBar) findViewById(R.id.progressBar);


        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
        webSettings.setDefaultZoom(WebSettings.ZoomDensity.FAR);

        webView.setWebViewClient(new WebViewClient(){
            @Override
            public void onLoadResource(WebView view, String url) {
                super.onLoadResource(view, url);
                progressBar.setProgress(view.getProgress());
            }

            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                super.onPageStarted(view, url, favicon);
                progressBar.setVisibility(View.VISIBLE);

            }

            @Override
            public void onPageFinished(WebView view, String url) {
                super.onPageFinished(view, url);
                progressBar.setVisibility(View.GONE);
            }
        });
        webView.loadUrl("https://www.example.com");