【发布时间】:2015-02-12 17:46:10
【问题描述】:
我的 webview 能够同时加载 https 和 http 网站 但不是https://www.google.com
它也不会抛出任何错误。
这是我的代码。我无法解决这个问题
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button btn = (Button) findViewById(R.id.Button1);
final EditText et=(EditText)findViewById(R.id.EditText1);
final WebView wv1=(WebView)findViewById(R.id.WebView1);
wv1.getSettings().setJavaScriptEnabled(true);
wv1.getSettings().setDomStorageEnabled(true);
wv1.setInitialScale(100);
et.setFocusable(true);
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
wv1.loadUrl(et.getText().toString());
}
});
wv1.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return true;
}
ca
public void onPageFinished(WebView view, String url) {
Toast.makeText(getApplicationContext(),"Page Finished",Toast.LENGTH_LONG).show();
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Toast.makeText(getApplicationContext(),"Error",Toast.LENGTH_LONG).show();
}
});
wv1.loadUrl("https://www.bing.com");
感谢您的任何帮助。
【问题讨论】:
-
请在您的网络客户端的两个覆盖方法中记录 url 的值
-
我尝试启用 cookie 但到目前为止没有任何效果