Web View无法使用某些特定的网址 [英] Web View not working with some specific url
本文介绍了Web View无法使用某些特定的网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public class MainActivity extends AppCompatActivity {
String url = "https://www.pinterest.com";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView webView = findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, final String url) {
}
});
webView.loadUrl(url);
}
}
Web视图未在应用程序中加载" https://www.pinterest.com ",但正在使用Intent使用chrome浏览器.我试过其他网址,它的工作.使用网络视图加载" https://www.pinterest.com 时,获得如下所示的输出屏幕
Web View is not loading "https://www.pinterest.com" within the application but it was working with chrome browser using intent. I tried of other urls it's working. While loading "https://www.pinterest.com" using webview, getting the output screen like below
推荐答案
您可以尝试以下操作:
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setAllowContentAccess(true);
settings.setDomStorageEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.loadUrl("https://www.pinterest.com/");
清单中
android:hardwareAccelerated="true"
这篇关于Web View无法使用某些特定的网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文