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

首先到vip.wxticket.com开通一个生成跳转ticket接口。wap跳转到微信基于微信ticket协议

拿到ticket以后通过js即可进行跳转:

  1. <!doctype html>
  2. <html lang="zh-cn">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>跳转中 </title>
  6. <meta http-equiv="pragma" content="no-cache">
  7. <meta http-equiv="cache-control" content="no-cache">
  8. <meta http-equiv="expires" content="0">
  9. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  10. <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>
  11. </head>
  12. <body>
  13. <div style="z-index:9999;position:absolute;display: table;left:0px;top:0px;width:100%;height:100%;">
  14. <div id="loading" style="display: table-cell; vertical-align:middle; text-align:center;font-size:16px;color:#434343;">
  15. 加载中...
  16. </div>
  17. <div id="buttons" style="display: none; vertical-align:middle; text-align:center;font-size:14px;color:gray;">
  18. <p>如果跳转失败请重试 </p>
  19. <p> <a class='button' onclick='window.location.replace(location.href+(location.href.match(/\?/i)?"&":"?")+"_rft"+ (new Date()).valueOf());'>重新打开 </a> </p>
  20. <p> <a class='button' onclick='window.history.back();'>返 回 </a> </p>
  21. </div>
  22. </div>
  23. <!-- *******
  24. 微信跳转联系QQ:904999988
  25. 网址:vip.wxticket.com
  26. ******* -->
  27. <script>
  28. var ticket = 'ta181172a79f5b3d568454a5a3192ba74';
  29. if(! /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)){
  30. if( / baiduboxapp/i.test(navigator.userAgent)){
  31. 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');
  32. } else{
  33. window.location.replace( 'weixin://dl/business/?ticket='+ticket+ '#wechat_redirect');
  34. }
  35. } else{
  36. window.location.replace( 'weixin://dl/business/?ticket='+ticket+ '#wechat_redirect');
  37. }
  38. setTimeout( function(){ document.getElementById( "loading").style.display= "none"; document.getElementById( "buttons").style.display= "table-cell";}, 3000);
  39. </script>
  40. </body>
  41. </html>

猜你喜欢

转载自blog.csdn.net/qq_38493094/article/details/80983852