您的位置:首页 > 移动开发 > 微信开发

手机浏览器跳转微信,wap跳转微信浏览器打开网页代码

2018-03-24 11:03 1531 查看
首先到www.weixin139.com开通一个生成跳转ticket接口。wap跳转到微信基于微信ticket协议
拿到ticket以后通过js即可进行跳转:<!doctype html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title>跳转中</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<style>.button{width:100px;margin:auto;border:1px solid gray;border-radius:4px;background-color:#fff;color:#434343;display:block;padding:15px 0;font-size:15px;line-height:0;text-align:center;}</style>
</head>
<body>

<div style="z-index:9999;position:absolute;display: table;left:0px;top:0px;width:100%;height:100%;">
<div id="loading" style="display: table-cell; vertical-align:middle; text-align:center;font-size:16px;color:#434343;">
加载中...
</div>
<div id="buttons" style="display: none; vertical-align:middle; text-align:center;font-size:14px;color:gray;">
<p>如果跳转失败请重试</p>
<p><a class='button' onclick='window.location.replace(location.href+(location.href.match(/\?/i)?"&":"?")+"_rft"+ (new Date()).valueOf());'>重新打开</a></p>
<p><a class='button' onclick='window.history.back();'>返 回</a></p>
</div>
</div>
<!-- *******
微信跳转联系QQ:192584
网址:www.weixin139.com
******* -->
<script>
var ticket = 'ta181172a79f5b3d568454a5a3192ba74';
if(!/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)){
if(/ baiduboxapp/i.test(navigator.userAgent)){
window.location.replace('bdbox://utils?action=sendIntent&minver=7.4¶ms=%7B%22intent%22%3A%22weixin://dl/business/?ticket='+ticket+'%23wechat_redirect%23Intent%3Bend%22%7D');
}else{
window.location.replace('weixin://dl/business/?ticket='+ticket+'#wechat_redirect');
}
}else{
window.location.replace('weixin://dl/business/?ticket='+ticket+'#wechat_redirect');
}
setTimeout(function(){document.getElementById("loading").style.display="none";document.getElementById("buttons").style.display="table-cell";},3000);
</script>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: