240
世界上有10种人,一种懂二进制,另一种不懂二进制。

微信点击链接,唤起浮层,然后用外部浏览器打开唤起某APP

微信点击链接,点击唤起某APP,在微信点开,默认是微信浏览器,点击button唤起,则会先提示浮层,然后用外部浏览器打开即可

源码如下:

<!DOCTYPE HTML>
<html>
<head>
<meta charset ="utf-8">
<meta content="telephone=no,email=no" name="format-detection" />
<meta name="viewport" content="initial-scale=1, user-scalable=no, minimum-scale=1, maximum-scale=1.0">
<title>我是标题</title>
<style>
html{ width:100%; height:100%;}
body{width:100%; height:100%; position:relative;margin:0; padding:0;-webkit-tap-highlight-color:rgba(0,0,0,0); -webkit-user-select:none;background-color: rgba(0,0,0,.9);}
p,input,ul,li,h3{ margin:0; padding:0; list-style:none; font-weight:normal;}
.container{ width:100%; height:100%; position:relative;}
.main{ width:640px; height:1028px; position: relative;  background:url(../images/new/qidong_bg.jpg) no-repeat; background-size:100% 100%; margin:0 auto; overflow:hidden; } 
.enterBtn{  width: 295px; height:98px; background-repeat:no-repeat; background-position:center;  background-image:url(../images/new/qidong_start.png) ; background-size: 100%; position:absolute; left:172px; top:840px;   }
.openTip{ width:640px; height:1040px; position: absolute; top:0; left: 0; background-repeat:no-repeat;background-size:100% 100%; margin:0 auto; overflow:hidden; display:none; background-color:rgba(0,0,0,0.8)}
</style>
<script type="text/javascript">
var down,move,up;
var ziw = 100;
if((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1) || (navigator.userAgent.indexOf('iPad') != -1) || (/android/gi).test(navigator.appVersion))
{
    var cw  =   window.innerWidth < window.screen.availWidth ? window.innerWidth : window.screen.availWidth;
    ziw = cw / 640 * 100;
    var str_css = '#container{zoom:'+(ziw)+'%}';
    var style = document.createElement("style");
    style.type = "text/css";
    style.innerHTML = str_css;
    document.getElementsByTagName("HEAD").item(0).appendChild(style);
    down = 'touchstart',up = 'touchend',move = 'touchmove';
}else{
    down = 'mousedown',up = 'mouseup',move = 'mousemove';
    }
</script>

</head>

<body>
<div class="container" id="container">
	<div class="main" >
	  <div class="enterBtn" onclick="triggerDownload()">
	  </div>
    </div>
	<div class="openTip"  id="openTip">  </div>
</div>
<script type="text/javascript">

function $id(id){
    return typeof id === "string" ? document.getElementById(id) : id;       
}

function IsIosAndroid(){
    if((/android/gi).test(navigator.appVersion)){
        return 1;
    }else if((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1) || (navigator.userAgent.indexOf('iPad') != -1)){
        return 2;
    }
}


function openAndroid()
{
	window.location.href ="ssqzmj://ssqzmj.abukeji.com";
	
}

function openIos()
{
	window.location.href = "ssqzmj://";
}

function is_weixn(){
    var ua = navigator.userAgent.toLowerCase();
    if(ua.match(/MicroMessenger/i)=="micromessenger") {
        return true;
    } else {
        return false;
    }
}


function triggerDownload(){

    if(IsIosAndroid()==1){
        if(is_weixn())
        {
            $id("openTip").style.backgroundImage="url(../images/new/fuceng.png)";
            $id("openTip").style.display='block';
            return;
        }
        openAndroid();
    }else if(IsIosAndroid()==2){
        if(is_weixn())
        {
            $id("openTip").style.backgroundImage="url(../images/new/fuceng.png)";
            $id("openTip").style.display='block';
            return;
        }
        openIos();
    }
}

</script>
</body>
</html>

  

posted @ 2018-06-24 20:08  unionline  阅读(700)  评论(0)    收藏  举报