QQ微信域名防封 预防域名封禁 微信强制跳转至浏览器打开

此方法可以实现微信内置浏览器跳转到手机其它浏览器,现在网上其它的方法都只是一个页面,让访问者自己手动点右上角浏览器打开,而这个不同,是可以直接自动跳转的。

 

QQ微信域名防封 预防域名封禁 微信强制跳转至浏览器打开

已经做了安卓和IOS的适配。需要替换其中要跳转的网址,然后保存为php文件,在微信内访问即可实现自动跳转:

 
  1.  
  2. <?php

  3. error_reporting(0);

  4. if($_GET[‘open‘]==1 && strpos($_SERVER[‘HTTP_USER_AGENT‘], ‘MicroMessenger‘)!==false){

  5. header("Content-Disposition: attachment; filename=\"load.doc\"");

  6. header("Content-Type: application/vnd.ms-word;charset=utf-8");

  7. }

  8. ?>

  9. <!DOCTYPE html>

  10. <html>

  11. <head>

  12. <meta charset="UTF-8">

  13. <title>Welcome</title>

  14. <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/>

  15. <meta content="yes" name="apple-mobile-web-app-capable"/>

  16. <meta content="black" name="apple-mobile-web-app-status-bar-style"/>

  17. <meta name="format-detection" content="telephone=no"/>

  18. <meta content="false" name="twcClient" id="twcClient"/>

  19. <style>

  20. body,html{width:100%;height:100%}

  21. *{margin:0;padding:0}

  22. body{ outline: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; margin: 8px 0px 0px 40px; list-style-type: decimal; word-wrap: break-word;">

    .top-bar-guidance{font-size:15px;color:#fff;height:40%;line-height:1.8;padding-left:20px;padding-top:20px;background:url(//gw.alicdn.com/tfs/TB1eSZaNFXXXXb.XXXXXXXXXXXX-750-234.png) center top/contain no-repeat}

  23. .top-bar-guidance .icon-safari{width:25px;height:25px;vertical-align:middle;margin:0 .2em}

  24. .app-download-btn{display:block;width:214px;height:40px;line-height:40px;margin:18px auto 0 auto;text-align:center;font-size:18px;color:#2466f4;border-radius:20px;border:.5px #2466f4 solid;text-decoration:none}

  25. </style>

  26. </head>

  27. <body>

  28. <div class="top-bar-guidance">

  29. <p>

  30. 点击右上角<img src="//gw.alicdn.com/tfs/TB1xwiUNpXXXXaIXXXXXXXXXXXX-55-55.png" class="icon-safari"/> Safari打开

  31. </p>

  32. <p>

  33. 可以继续访问本站哦~

  34. </p>

  35. </div>

  36. <a class="app-download-btn" id="BtnClick" href="javascript:;"> 点此继续访问 </a>

  37. <script>

  38. var url = ‘http://www.youngxj.cn‘;//更改需要跳转的地址

  39. document.querySelector(‘body‘).addEventListener(‘touchmove‘, function (event) {

  40. event.preventDefault();

  41. });

  42. window.mobileUtil = (function(win, doc) {

  43. var UA = navigator.userAgent,

  44. isAndroid = /android|adr/gi.test(UA),

  45. isIOS = /iphone|ipod|ipad/gi.test(UA) && !isAndroid,

  46. isBlackBerry = /BlackBerry/i.test(UA),

  47. isWindowPhone = /IEMobile/i.test(UA),

  48. isMobile = isAndroid || isIOS || isBlackBerry || isWindowPhone;

  49. return {

  50. isAndroid: isAndroid,

  51. isIOS: isIOS,

  52. isMobile: isMobile,

  53. isWeixin: /MicroMessenger/gi.test(UA),

  54. isQQ: /QQ/gi.test(UA)

  55. };

  56. })(window, document);

  57. if(mobileUtil.isWeixin){

  58. if(mobileUtil.isIOS){

  59. url = "https://t.asczwa.com/taobao?backurl=" + encodeURIComponent(url);

  60. document.getElementById(‘BtnClick‘).href=url;

  61. }else if(mobileUtil.isAndroid){

  62. url = ‘?open=1‘;

  63. document.getElementById(‘BtnClick‘).href=url;

  64. var iframe = document.createElement("iframe");

  65. iframe.style.display = "none";

  66. iframe.src = url;

  67. document.body.appendChild(iframe);

  68. }

  69. }else{

  70. document.getElementById(‘BtnClick‘).href=url;

  71. window.location.replace(url);

  72. }

  73. //setTimeout(‘WeixinJSBridge.invoke("closeWindow", {}, function(e) {})‘, 2000); </script>

  74. </body>

  75. </html>

跳转域名需要备案,具体自行测试

QQ微信域名防封 预防域名封禁 微信强制跳转至浏览器打开

上一篇:request模块的简单使用+爬虫小程序


下一篇:微信接入