Is it possible Redirect to specific url if page viewed from android by detecting it's package name (or another identificator information) from website (html or javascript)?
Asked
Active
Viewed 113 times
0
-
You could try the contents of `window.navigator`? I'm not sure if you can find specific information about it tho. – acenturyandabit Apr 02 '20 at 12:04
2 Answers
0
I think this idea is impossible if you brows your web page from external browser (like google chrome).
So I suggest to brows the web page in a webview inside your android application and make your code listen for this webview by extend WebViewClient and call onPageFinished() :
mWebView.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
// do your stuff here
}
});
In the web app you can make a specific page for redirecting (for example www.your_website.com/redirecting.html) , and make the app do what you want when surf this link :
mWebView.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
// do your stuff here
if(url == "www.your_website.com/redirecting.html"){
//do what you want...
}
}
});

Mohammed Alloboany
- 129
- 8