java - How to only allow links in a webView to be opened by other applications? -
making android app loads url in webview webpage contains links images , videos not want opened within webview, if user clicks on link doesn't load 1 of whitelisted links want prompt user open link in android web browser or google chrome.
so far 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 still allows links opened in webview.
Comments
Post a Comment