的WebView是不开放google.com [英] WebView is not opening google.com

查看:152
本文介绍了的WebView是不开放google.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的WebView能够加载两个HTTPS和放大器; HTTP站点
但是,并非 https://www.google.com

My webview is able to load both https & http sites But not https://www.google.com

这不会引发任何错误无论是。

It doesn't throw any error either.

下面是我的code.I我无法来解决这个问题。

Here is my code.I am unable to solve this problem

     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");

感谢任何形式的帮助。

Thanks for any kind of help.

推荐答案

有一个bug在你的code

There is a bug in your code

您code

public boolean shouldOverrideUrlLoading(WebView view, String url) {
            return true;
        }

正确code

 public boolean shouldOverrideUrlLoading(WebView view, String url) {
                return false;
            }

ShouldOverrideUrlLoading 中的WebView假返回的打开URL 的。
开放在其他一些应用程序

这篇关于的WebView是不开放google.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆