C
C
cfmm2016-09-01 15:12:15
Android
cfmm, 2016-09-01 15:12:15

WebView determine what to open url in new window?

I have a simple webview application. Is there any way in the WebChromeClient or WebClient instance to determine that the page needs to be opened in a new window? (for example, a new window needs to be opened, in case of clicking on a link like: a target="_blank" href="...")

mWebView = new WebView(activity);
mWebView.setWebChromeClient(new WebChromeClient() {...});
mWebView.setWebViewClient(new WebClient() {...});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
        mWebView.getSettings().setAllowUniversalAccessFromFileURLs(true);

WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setSupportMultipleWindows(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
        mWebView.getSettings().setAllowUniversalAccessFromFileURLs(true);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question