webView loadUrl opens browser choice dialog

淺唱寂寞╮ 提交于 2020-01-16 00:29:10

问题


I have three Fragment. I have sent a String(URL) from third Fragment to the First Fragment. First Fragment has a webView . I want to show website on the webView which I passes from third fragment./ But I am facing one problem It shows me Dialog to choose one browser rather than showing the URl on the webview. This is the code.

        String url="http://www.hotelsearcher.net/";
        Bundle args = getArguments();
        if (args  != null){
        url = args.getString("url");
        }
//      url=FragmentC.url;
        WebView webView= (WebView) V.findViewById(R.id.webView1);
        WebSettings webViewSettings = webView.getSettings();
        webViewSettings.setJavaScriptCanOpenWindowsAutomatically(true);
        webViewSettings.setJavaScriptEnabled(true);
        webViewSettings.setPluginState(PluginState.ON);
        webView.loadUrl(url);

回答1:


Put this in webview:

webViewSettings.setWebViewClient(new WebViewClient());


来源:https://stackoverflow.com/questions/24558423/webview-loadurl-opens-browser-choice-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!