How to open iOS app from browser?

前端 未结 1 640
深忆病人
深忆病人 2021-01-21 13:10

I have to open my iOS app whenever user open a link of my app in browser. I have already used a like myApp:// but i want to open my app even when user open an http

相关标签:
1条回答
  • 2021-01-21 13:40

    Here is an example using jQuery:

    $(document).ready(function() {
    
            var user_agent_header = navigator.userAgent;
    
            if(user_agent_header.indexOf('iPhone')!=-1 || user_agent_header.indexOf('iPod')!=-1 || user_agent_header.indexOf('iPad')!=-1){
                setTimeout(function() { window.location="myApp://www.myapp.com";}, 25);
            }
    
        });
    
    0 讨论(0)
提交回复
热议问题