標籤:append play ati agent phone body iframe mes rom
window.onload = function () { jumpToapp()}var browser = { isAndroid: function () { return navigator.userAgent.match(/Android/i) ? true : false; }, isMobileQQ: function () { var ua = navigator.userAgent; return /(iPad|iPhone|iPod).*? (IPad)?QQ\/([\d\.]+)/.test(ua) || /\bV1_AND_SQI?_([\d\.]+)(.*? QQ\/([\d\.]+))?/.test(ua);}, isIOS: function () { return navigator.userAgent.match(/iPhone|iPad|iPod/i) ? true : false;}, isWx: function () { return navigator.userAgent.match(/micromessenger/i) ? true : false;}, isChrome: function () { return navigator.userAgent.match(/chrome/i) ? true : false; }};var createIframe = (function () { var iframe; return function () { if (iframe) { return iframe; } else { iframe = document.createElement(‘iframe‘); iframe.style.display = ‘none‘; document.body.appendChild(iframe); return iframe; } }})()var jumpToapp = function () { var isAndroid = function () { return navigator.userAgent.match(/Android/i) ? true : false; } var isIOS = function () { return navigator.userAgent.match(/iPhone|iPad|iPod/i) ? true : false; }if (isIOS()) { window.location.href = "sxz://sxz.com";//偽協議scheme} else if (isAndroid()) { var ifr = document.createElement(‘iframe‘); ifr.src = "sxz://sxz.com";//偽協議scheme ifr.style.display = ‘none‘; document.body.appendChild(ifr); } }$(‘#open_app‘).click(function () { openApp();})var openApp = function () { if (browser.isIOS()) { window.location.href = "ios"; } else if (browser.isAndroid()) { window.location.href = "安卓"; }
h5 掃描二維碼開啟app和點擊下載功能的實現