我正在尝试在WebView中显示一个网页,直到昨天它工作正常,现在只显示空白。问题是该链接在chrome和firefox中可以正常打开,而所有其他链接在我的webview中也可以正常工作,这似乎是什么问题?我想我的应用程序配置中缺少什么?
这是网址:https://morocco.blsspainvisa.com/book_appointment.php
我尝试了一个来自github的随机浏览器项目,它和我有同样的问题,所以也许网站已经更改了一些限制?
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setUseWideViewPort(true);
webSettings.setSupportZoom(true);
webSettings.setBuiltInZoomControls(true);
webSettings.setDisplayZoomControls(false);
mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
mWebView.setScrollbarFadingEnabled(false);
webSettings.setRenderPriority(WebSettings.RenderPriority.HIGH);
mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
mWebView.setScrollbarFadingEnabled(false);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
} else {
mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
String newUA= "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0";
webSettings.setUserAgentString(newUA);
mWebView.loadUrl("https://morocco.blsspainvisa.com/book_appointment.php");
mWebView.addJavascriptInterface(new webAppInterface(this),"Android");
mWebView.setWebChromeClient(new WebChromeClient(){..};
mWebView.setWebViewClient(new WebViewClient(){..}