<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name='apple-itunes-app' content='app-id=1115968341'> <title></title> </head> <body> <a href="https://itunes.apple.com/cn/app/yi-fang-kuai-le-xue-tang/id1115968341?mt=8" id="openApp">点击打开</a> <script type="text/javascript"> //苹果 document.getElementById('openApp').onclick = function(e){ // 通过iframe的方式试图打开APP,如果能正常打开,会直接切换到APP,并自动阻止a标签的默认行为 // 否则打开a标签的href链接 var ifr = document.createElement('iframe'); ifr.src = 'iosefunbox://'; ifr.style.display = 'none'; document.body.appendChild(ifr); window.setTimeout( function(){ document.body.removeChild(ifr); }, 3000 ) }; </script> </body> </html>