Im creating a website using MVC 4, and I have a need to within a javascript open an application, using an url-scheme (surfing the site using a mobile device) If the application is not installed, I need the javascript to redirect to google play.
I have looked and tried all various methods mentioned in threads like this: How to fall back to marketplace when Android custom URL scheme not handled?
Many of those solutions relies on a timeout-event, which will redirect to another website if the app is not installed. The problem I am encountering is that after I have used the window.location = URL;
in my javascript, any timeouts I have created seems to just dissapear. If i skip the window.location = URL;
my timeouts fire just fine and redirects to google play or whatever. Does anyone understand why i am having this problem?
As I said im using MVC 4, and executes a javascript within a simple view. I have tried many different codes, opening iframes etc, all resulting in the same problem mentioned above. I just tried opening the app, and delaying an ITunes redirect on a iPhone-device using Safari, it seems to work. Can the same be achieved with android/chrome?
I would appreciate any help I could get considering this.