Is it possible to use a browser for the application? (no popup)

I am trying to connect to the app from the browser, which works great. But the problem is that iOS shows "Safari cannot open the page" and then redirects to the app store (fallback).

Is it possible to create some JS magic to keep the popup from showing up?

Here is the code:

    var now = new Date().valueOf();
    setTimeout(function () {
        if (new Date().valueOf() - now > 100) return;
        window.location = "https://itunes.apple.com/us/app/twitter/id333903271?mt=8";
    }, 10);
    window.location = "twitter://timeline";

      

+3


source to share


1 answer


I ran into a similar scenario a while ago and I figured the best way is to have an iframe and provide it with a source.

function mobileDeepLink() {
    var iframe = document.createElement('iframe');
    iframe.src = "twitter://timeline";

    // hide iframe visually
    iframe.width = 0;
    iframe.height = 0;
    iframe.frameBorder = 0;

    var now = new Date().valueOf();
    setTimeout(function () {
        if (new Date().valueOf() - now > 100) return;
        window.location = "https://itunes.apple.com/us/app/twitter/id333903271?mt=8";
    }, 10);

    // Append it to the body.
    document.body.appendChild(iframe);
    iframe.parentNode.removeChild(iframe);
}

mobileDeepLink();

      

This way you will not see an error popup when this schema cannot be found.



Update

This approach will only work for IOS 8 and below. Starting with IOS 9 and later, deep linking is supported based on universal links.

+5


source







All Articles