How to redirect the user to a mobile app or a website on click of a hyperlink sent in an email? Should it need to be handled on server-side using PHP?

前端 未结 5 1416
臣服心动
臣服心动 2020-12-31 19:04

I\'ve a website which is already developed using PHPFox and it\'s working fine. Now, iOS development team has created a mobile app in iOS for the same funct

5条回答
  •  借酒劲吻你
    2020-12-31 19:43

    Using javascript, you can have a landing page to tunnel the users:

    You can redirect the user to an app scheme using the following:

     document.location="myApp://myUrl";
    

    If the browser does not find the uri scheme, you can use a setTimeout to redirect the user to your webpage

    setTimeout(function() {
       document.location="/path/inside/website.html";
    }, 100);
    

    Another good solution would be to test the existence of the url schema using an iframe on a small test file, and redirect the current page if the iframe can be loaded

    
    
    

提交回复
热议问题