Android – Open target _blank links in WebView with external browser

After visiting the above links, I come up with this code and hope this helps. wv.getSettings().setSupportMultipleWindows(true); wv.setWebChromeClient(new WebChromeClient() { @Override public boolean onCreateWindow(WebView view, boolean dialog, boolean userGesture, android.os.Message resultMsg) { WebView.HitTestResult result = view.getHitTestResult(); String data = result.getExtra(); Context context = view.getContext(); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(data)); context.startActivity(browserIntent); return false; } });

Are WebViewClient and WebChromeClient mutually exclusive?

You certainly can use both, they just have different functions. Setting your own custom WebViewClient lets you handle onPageFinished, shouldOverrideUrlLoading, etc., WebChromeClient lets you handle Javascript’s alert() and other functions. Just make your own class, for example: public class MyWebChromeClient extends WebChromeClient { //Handle javascript alerts: @Override public boolean onJsAlert(WebView view, String url, String message, … Read more

Enabling general JavaScript in WebViewClient

I don’t know what your exact problem is, but i can enable the JavaScript and a custom WebViewclient without any problem: WebView vistaWeb = (WebView) findViewById(R.id.webview); vistaWeb.setWebChromeClient(new MyCustomChromeClient(this)); vistaWeb.setWebViewClient(new MyCustomWebViewClient(this)); vistaWeb.clearCache(true); vistaWeb.clearHistory(); vistaWeb.getSettings().setJavaScriptEnabled(true); vistaWeb.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);

What’s the difference between setWebViewClient vs. setWebChromeClient?

From the source code: // Instance of WebViewClient that is the client callback. private volatile WebViewClient mWebViewClient; // Instance of WebChromeClient for handling all chrome functions. private volatile WebChromeClient mWebChromeClient; // SOME OTHER SUTFFF……. /** * Set the WebViewClient. * @param client An implementation of WebViewClient. */ public void setWebViewClient(WebViewClient client) { mWebViewClient = client; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)