lifeTech
V2EX  ›  问与答

求教一个 h5 页面通过链接打开 app 指定页面的问题

  •  
  •   lifeTech · May 25, 2016 · 4565 views
    This topic created in 3666 days ago, the information mentioned may be changed or developed.

    现在的方案是通过这种方式实现的,但在 ios9 上却会提示是否打开,想去掉这种提示。或者求大牛赐教一种更好的实现方案

    贴吧客户端

    <script type="text/javascript"> document.getElementById('openApp').onclick = function(e){ // 通过 iframe 的方式试图打开 APP ,如果能正常打开,会直接切换到 APP ,并自动阻止 a 标签的默认行为 // 否则打开 a 标签的 href 链接 var ifr = document.createElement('iframe'); ifr.src = 'com.baidu.tieba://'; ifr.style.display = 'none'; document.body.appendChild(ifr); window.setTimeout(function(){ document.body.removeChild(ifr); },3000) }; </script>
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2651 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 15:43 · PVG 23:43 · LAX 08:43 · JFK 11:43
    ♥ Do have faith in what you're doing.