How to open Mobile Application from Web Browser using Javascript

Hi!

I would like to open an Android or IOS application from the web browser using Javascript.

The condition is this: If the application does not exists, AppStore or PlayStore would open instead.

I have tried:

var loadedAt = +new Date;
	        setTimeout(
	                   function(){
	                       if (+new Date - loadedAt < 2000){
	                   window.location = 'market://details?id=someApp;
	                       }
	                   }
	                   ,25);

	        window.open('android-app://com.mycompany.myapp,"_self");

But In Android, both the app and the PlayStore always opens.

Can I have the PlayStore open only if the App is not installed?

Please help. Thanks.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.