搜尋

首頁  >  問答  >  主體

javascript - 手機端web頁面,怎麼判斷ios是否安裝了某個app?

手機端web頁面,怎麼判斷ios是否安裝了某個app?

学习ing学习ing2815 天前1144

全部回覆(1)我來回復

  • typecho

    typecho2017-07-01 09:14:24

    這個問題segmentfault上有. IOS 網頁能判斷有沒有安裝應用
    很久沒去看了. 試試:

    <script language="javascript">  
     if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {  
      var loadDateTime = new Date();  
      window.setTimeout(function() {  
       var timeOutDateTime = new Date();  
       if (timeOutDateTime - loadDateTime < 5000) {  
        window.location = "要跳转的页面URL";  
       } else {  
        window.close();  
       }  
      },  
      25);  
      window.location = " apps custom url schemes ";  
     } else if (navigator.userAgent.match(/android/i)) {  
      var state = null;  
      try {  
       state = window.open("apps custom url schemes ", '_blank');  
      } catch(e) {}  
      if (state) {  
       window.close();  
      } else {  
       window.location = "要跳转的页面URL";  
      }  
     }  
    </script> 

    回覆
    0
  • 取消回覆