1

Making an Android app that loads a url in a webView but the webpage contains links to images and videos that i do not want opened within the webview, If the user clicks on a link that doesn't load one of the whitelisted links then i want it to prompt the user to open the link in the android web browser or google chrome.

So far i have this:

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    String url = "http://myurlhere.com";
    WebView view = (WebView) this.findViewById(R.id.webView1);
    view.getSettings().setJavaScriptEnabled(true);
    view.setWebViewClient(new WebViewClient());
    view.loadUrl(url);
    String currentUrl = view.getUrl();
    if (currentUrl != url) {
        view.loadUrl(url);
    }

}

But this still allows links to be opened in the webView.

Skilo Skilo
  • 526
  • 4
  • 11
  • 23

0 Answers0