<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title></title>
<script type="text/javascript">
document.addEventListener('plusready', function() {
//console.log("所有plus api都应该在此事件发生后调用,否则会出现plus is undefined。")
});
</script>
<style>
* {
padding: 0;
margin: 0;
}
a {
display: block;
width: 6.88rem;
height: 2.5rem;
background: linear-gradient(135deg, #FF374E 0%, #C92B3E 100%);
opacity: 1;
border-radius: 2rem;
text-decoration: none;
text-align: center;
line-height: 2.5rem;
color: #FFFFFF;
}
.wxtip {
background: rgba(0, 0, 0, 0.8);
text-align: center;
position: fixed;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 998;
display: none;
}
.wxtip-icon {
width: 52px;
height: 67px;
display: block;
position: absolute;
right: 20px;
top: 20px;
}
.wxtip-txt {
margin-top: 107px;
color: #fff;
font-size: 16px;
line-height: 1.5;
}
</style>
</head>
<body>
<div class="wrap">
<div>
<a href="http://chatting-app.oss-cn-chengdu.aliyuncs.com/ctzm.apk" id="JdownApp">立即下载</a>
</div>
</div>
<div class="wxtip" id="JweixinTip">
<span class="wxtip-icon"></span>
<p class="wxtip-txt">点击右上角<br/>选择在浏览器中打开</p>
</div>
</body>
<script>
function weixinTip(ele) {
if (isWechat()) {
ele.onclick = function(e) {
window.event ? window.event.returnValue = false : e.preventDefault();
document.getElementById('JweixinTip').style.display = 'block';
}
document.getElementById('JweixinTip').onclick = function() {
this.style.display = 'none';
}
}
}
//方法1:判断是否是微信内置浏览器打开页面
function isWechat() {
var ua = navigator.userAgent.toLowerCase(),flag = false;
if(ua.indexOf("micromessenger") > -1){
flag = true;
}else {
flag = false;
}
return flag;
}
//方法1
/* function isWechat() {
var ua = navigator.userAgent;
var isWeixin = !!/MicroMessenger/i.test(ua);
return isWeixin
}
*/
var btn1 = document.getElementById('JdownApp'); //下载一
weixinTip(btn1);
</script>
</html>
微信h5页面跳转浏览器 在微信中点击链接直接跳转到手机默认浏览器代码实现
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。