啟用JavaScript后,部分頁面死掉,提示err_unknown_url_scheme?
啟用JavaScript后,訪問百度首頁(http://www.baidu.com)是OK的,但點擊百度首頁的新聞,就會出現這種頁面
然后,LogCat的信息:
W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 8507
W/art: Attempt to remove non-JNI local reference, dumping thread
2018-04-04
問題已解決,終于能打開二級頁面了!
解決方法:
來源:https://blog.csdn.net/jingleye/article/details/53466680
1、在使用webView之前添加這些:
settings.setDatabaseEnabled(true);
??????? settings.setGeolocationEnabled(true);
??????? String dir = this.getCacheDir()+"/baidudata";
??????? settings.setGeolocationDatabasePath(dir);
??????? settings.setDomStorageEnabled(true);
??????? settings.setJavaScriptEnabled(true);// 允許請求JS
??????? settings.setBuiltInZoomControls(true);
2、然后重寫shouldOverrideUrlLoading()方法:
webView.setWebViewClient(new WebViewClient() {
??????????? @Override
??????????? public boolean shouldOverrideUrlLoading(WebView view, String url) {
??????????????? if (url.startsWith("http:") || url.startsWith("https:")) {
??????????????????? view.loadUrl(url);
??????????????? } //屏蔽掉錯誤的重定向url:"baidumap://map/?src=webapp.default.all.callnaonopenwebapp?"
??????????????? return super.shouldOverrideUrlLoading(view, url);
??????????? }
2018-04-04
剛入門,解決不來
百度了下好多解決辦法都用差不多這個,你試試?
https://blog.csdn.net/jdsjlzx/article/details/47727719
2018-04-03
是不是該用https?,現在大部分網站都該用了https,據說要淘汰http了,你試下唄