var download_schema = 'taobao://'; var universal_link = 'ios下载地址'; var getVersionUrl = 'Android下载地址'; var u = navigator.userAgent.toLocaleLowerCase();
var isWeixin = u.match(/MicroMessenger/i) == 'micromessenger'; var isAndroid = u.indexOf('android') > -1 || u.indexOf('linux') > -1; var isiOS = !! u.match(/(iphone|ipod|ipad|mac)/i); function openApp() { if (isAndroid) { android1(); } if (isiOS) { ios(); } } function android1() { if (isWeixin) { window.location.href = "Android下载地址 "; } else { window.location.href = download_schema; window.setTimeout(function () { window.location.href = getVersionUrl; }, 100); } } function ios() { window.location.href = universal_link + "?schema=" + encodeURIComponent(download_schema); }
|