I am using javascript to check if app is installed or not, if my app installed i want to open my app or else it will redirect to play store account. the issue is that it is redirecting to play store even i already have app installed
This is my .html file where i am checking for app
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
window.onload = function() {
// Deep link to your app goes here
document.getElementById("l").src = "intent://sdf/SplashScreen#Intent;scheme=vsd;package=.sdf.android.ff;end";
setTimeout(function() {
// Link to the App Store should go here -- only fires if deep link fails
window.location = ".sdf.android.dffd";
}, 500);
};
</script>
<iframe id="l" width="1" height="1" style="visibility:hidden"></iframe>
</body>
</html>
I am using javascript to check if app is installed or not, if my app installed i want to open my app or else it will redirect to play store account. the issue is that it is redirecting to play store even i already have app installed
This is my .html file where i am checking for app
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
window.onload = function() {
// Deep link to your app goes here
document.getElementById("l").src = "intent://sdf/SplashScreen#Intent;scheme=vsd;package=.sdf.android.ff;end";
setTimeout(function() {
// Link to the App Store should go here -- only fires if deep link fails
window.location = "https://play.google./store/apps/details?id=.sdf.android.dffd";
}, 500);
};
</script>
<iframe id="l" width="1" height="1" style="visibility:hidden"></iframe>
</body>
</html>
Share
Improve this question
edited May 2, 2019 at 7:34
chris
asked May 2, 2019 at 6:29
chrischris
7494 gold badges13 silver badges36 bronze badges
7
- I'd be surprised if that ever onload fired - perhaps set the onload before setting the source, but I still think it's a lost cause – Jaromanda X Commented May 2, 2019 at 6:39
- @JaromandaX please check edited question – chris Commented May 2, 2019 at 7:34
- so now you've removed the onload altogether - what stops the timeout from firing? nothing, it will always fire now, guaranteed – Jaromanda X Commented May 2, 2019 at 8:37
- right now issue is that, it is loading play store even the app installed or not – chris Commented May 2, 2019 at 8:55
- yes, why wouldn't it? – Jaromanda X Commented May 2, 2019 at 9:02
1 Answer
Reset to default 3It solved by this way
<html>
<head>
<script src="https://code.jquery./jquery-1.12.4.js"></script>
<script>
var fallbackToStore = function() {
window.location.replace('https://play.google./store/apps/details?id=packgename');
};
var openApp = function() {
window.location.replace('intent://app/SplashScreen#Intent;scheme=app_;package=.sdf.android.dsds;end');
};
var triggerAppOpen = function() {
openApp();
setTimeout(fallbackToStore, 700);
};
triggerAppOpen();
</script>
</head>
<body>
</body>
</html>