h5 扫描二维码打开app和点击下载功能的实现

智慧并不产生于学历,而是来自对于知识的终生不懈的追求。这篇文章主要讲述h5 扫描二维码打开app和点击下载功能的实现相关的知识,希望能为你提供帮助。

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 = "https://www.songbingjia.com/android/ios下载地址"; } else if (browser.isAndroid()) { window.location.href = "https://www.songbingjia.com/android/安卓下载地址"; }

【h5 扫描二维码打开app和点击下载功能的实现】 

    推荐阅读