In my mobile site I have links to other websites that also have apps. when my users click on the links they get options in Android (I don't know about iPhone) to go to the app or continue with the browser. How do I prevent the user from going to the apps and just cntinue with the browser after clicking my links without seeing this menu (browser/app)?
2 Answers
What you're asking is how to prevent the expected behavior of a webpage you load in your app. That's generally not good UI/UX design. But, to do so you would need to set a WebViewClient on your WebView and evaluate the url that is being loaded to see if it is for the download of an app:
webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url){
if (url.contains("play.google.com")) {
//handle alternate action here
}
}
@Override
public void onPageFinished(WebView view, String url){
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
}
});
-
Thanks for the answer but I have a mobile site in PhP and not an app. Is there also a way?– gooteisJan 26, 2016 at 6:52
-
That's something that's been set up on the 3rd party site, not something that's being done by the OS. There's no way to control the behavior of the browser after the user has left your web site.
For example LinkedIn will do this but Last Pass does not, even though they also have an app. This is something LinkedIn has chosen to do with their site; you can't do anything about that from your web site.