H5唤醒APP

【H5唤醒APP】识字粗堪供赋役,不须辛苦慕公卿。这篇文章主要讲述H5唤醒APP相关的知识,希望能为你提供帮助。

< !DOCTYPE html> < html lang="en"> < head> < meta charset="UTF-8"> < title> < /title> < script src="http://img.readke.com/220501/1504046209-0.jpg"> < /script> < /head> < body> < script type="text/javascript"> var isIphone = navigator.userAgent.match(/(iPhone|iPod|iPad); ?/i); var isandroid = navigator.userAgent.match(/android/i); //ios 9 以下 var iphoneSchema = ‘taobao://item.taobao.com/item.html?id=560597539512‘; //iOS 9及以上版本 var universalLink = ‘https://app.xxxxxx.com/share/project?cid=39783& cover=http://file.xxxxxx.com/eImg/uimages/20170901/1504260781459851.jpg‘; //https://app.xxxxxx.com/share/article?cid=39783& cover=http://file.xxxxxx.com/eImg/uimages/20170901/1504260781459851.jpg//Android 打开京东 var androidSchema = ‘taobao://item.taobao.com/item.html?id=560597539512‘; var downUrl = ‘http://android.myapp.com/myapp/search.htm?kw=%E4%BA%AC%E4%B8%9C‘; //下载连接var isWeixin = function(){ //判断是否是微信 var ua = navigator.userAgent.toLowerCase(); if (ua.match(/MicroMessenger/i) == "micromessenger") { return true; } else { return false; } }; (function(){ //微信 if (isIphone & & navigator.userAgent.match(/os\s+(\d+)/i)[1] - 0 > = 9) { //使用通用链接跳转(连接 路径 为 下载页路径, 后跟参数, 安装, 则跳转app,未安装则跳转对应 通用连接 进行下载) //重定向 到下载页面 window.location = universalLink; return false; } else { if (isWeixin()) { //在微信内置浏览器中,提醒用户用系统浏览器打开(AndroidiOS) alert(‘使用手机浏览器打开‘); } else { if (isIphone) { $(‘a‘).attr(‘href‘, downUrl); var ifr = document.createElement(‘iframe‘); ifr.src = https://www.songbingjia.com/android/iphoneSchema; ifr.style.display = ‘none‘; document.body.appendChild(ifr); setTimeout(function(){ document.body.removeChild(ifr); }, 3000); } else if (isAndroid) { window.location.href = androidSchema; setTimeout(function(){ window.location.href = downUrl; //android下载地址 },1000); return false; } else { //非iOS、Android 手机, 隐藏打开文章按钮 } } } }()); < /script> < /body> < /html>

 

    推荐阅读