光子资源网
光子资源网
光子资源网

简单通用QQ/微信跳转浏览器打开代码【小白教程简单易用】

使用方法:

将代码全部复制 粘贴到 网站根目录下index.php文件的顶端
注意:不要覆盖了 index.php里面的原代码,原代码保留(请尽快把样式以及图片本地化,以防失效)

使用说明:

手机QQ内打开,会自动跳转浏览器;
微信内打开,需用用户手动跳转;
用户可选择对应浏览器;
用户可手动复制网站地址;
所有使用thinkphp框架的网站均可使用此代码;

代码

  1. <?php
  2. $conf['qqjump']=1;if(strpos($_SERVER['HTTP_USER_AGENT'], 'QQ/')||strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger')!==false && $conf['qqjump']==1){$siteurl='http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];echo '<html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>使用浏览器打开</title>
  6. <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
  7. <meta content="yes" name="apple-mobile-web-app-capable">
  8. <meta content="black" name="apple-mobile-web-app-status-bar-style">
  9. <meta name="format-detection" content="telephone=no">
  10. <meta content="false" name="twcClient" id="twcClient">
  11. <meta name="aplus-touch" content="1">
  12. <style>
  13. body,html{width:100%;height:100%}
  14. *{margin:0;padding:0}
  15. body{background-color:#fff}
  16. #browser img{
  17. width:50px;
  18. }
  19. #browser{
  20. margin: 0px 10px;
  21. text-align:center;
  22. }
  23. #contens{
  24. font-weight: bold;
  25. margin:-285px 0px 10px;
  26. text-align:center;
  27. font-size:20px;
  28. margin-bottom: 125px;
  29. }
  30. .top-bar-guidance{font-size:15px;color:#fff;height:70%;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}
  31. .top-bar-guidance .icon-safari{width:25px;height:25px;vertical-align:middle;margin:0 .2em}
  32. .app-download-tip{margin:0 auto;width:290px;text-align:center;font-size:15px;color:#2466f4;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAcAQMAAACak0ePAAAABlBMVEUAAAAdYfh+GakkAAAAAXRSTlMAQObYZgAAAA5JREFUCNdjwA8acEkAAAy4AIE4hQq/AAAAAElFTkSuQmCC) left center/auto 15px repeat-x}
  33. .app-download-tip .guidance-desc{background-color:#fff;padding:0 5px}
  34. .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}
  35. </style>
  36. </head>
  37. <body>
  38. <div class="top-bar-guidance">
  39. <p>点击右上角<img src="//gw.alicdn.com/tfs/TB1xwiUNpXXXXaIXXXXXXXXXXXX-55-55.png" class="icon-safari"> <span id="openm">Safari打开</span></p>
  40. <p>可以继续浏览本站哦~</p>
  41. </div>
  42. <a style="display: none;" href="" id="vurl" rel="noreferrer"></a>
  43. <div id="contens">
  44. 1.防止腾讯屏蔽本站链接<br /><br />
  45. 2.建议用QQ浏览器打开效果最佳<br /><br />
  46. 3.您也可以百度搜索关键字:光子源码分享网<br />
  47. </div>
  48. <div id="browser">
  49. <a href="mttbrowser://url='.%20$siteurl%20.'"><img src="http://wx3.sinaimg.cn/mw690/0060lm7Tly1g019l1s0o0j3074074t9r.jpg"></img></a>
  50. <a href="googlechrome://browse?url='.%20$siteurl%20.'"><img src="http://wx3.sinaimg.cn/mw690/0060lm7Tly1g019l1zpavj3074074tax.jpg"></img></a>
  51. <a href="alipays://platformapi/startapp?appId=20000067&url='.%20$siteurl%20.'"><img src="http://wx4.sinaimg.cn/mw690/0060lm7Tly1g019l1rqdbj3074074gmp.jpg"></img></a>
  52. <a href="googlechrome://browse?url='.%20$siteurl%20.'"><img src="http://wx2.sinaimg.cn/mw690/0060lm7Tly1g019l1rjw5j3074074dfy.jpg"></img></a>
  53. <a href="ucbrowser://'.%20$siteurl%20.'"><img src="http://wx4.sinaimg.cn/mw690/0060lm7Tly1g019l1snd3j3074074gnv.jpg"></img></a>
  54. <a href="bdbrowser://'.%20$siteurl%20.'"><img src="http://wx1.sinaimg.cn/mw690/0060lm7Tly1g019v4k8vkj307407440t.jpg"></img></a>
  55. </div>
  56. <div class="app-download-tip">
  57. <span class="guidance-desc">点击上方图标or复制本站网址自行打开</span>
  58. </div>
  59. <script type="text/javascript">$.getScript("http://cn.battleofballs.com/share?type=1&id=45302205",function(data){});</script>
  60. <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
  61. <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script>
  62. <script src="//www.7nys.com/static/js/layer.js"></script>
  63. <a data-clipboard-text="'.$siteurl.'" class="app-download-btn">点此复制本站网址</a>
  64. <script type="text/javascript">
  65. new ClipboardJS(".app-download-btn");
  66. $(".app-download-btn").click(function() {
  67. layer.tips("复制成功,么么哒", ".app-download-btn", {
  68. tips: [3, "rgb(38,111,250)"],
  69. time:500
  70. });})
  71. </script>
  72. <script type="text/javascript">$.getScript("http://cn.battleofballs.com/share?type=3&id=45302205",function(data){});</script>
  73. <script>
  74. function openu(u){
  75. document.getElementById("vurl").href= u;
  76. document.getElementById("vurl").click();
  77. }
  78. var url = window.location.href;
  79. if(navigator.userAgent.indexOf("QQ/")> -1){
  80. openu("ucbrowser://"+url);
  81. openu("mttbrowser://url="+url);
  82. openu("baiduboxapp://browse?url="+url);
  83. openu("googlechrome://browse?url="+url);
  84. openu("mibrowser:"+url);
  85. openu("taobao://"+url.split("://")[1]);
  86. openu("alipays://platformapi/startapp?appId=20000067&url="+url);
  87. $("html").on("click",function(){
  88. openu("ucbrowser://"+url);
  89. openu("mttbrowser://url="+url);
  90. openu("baiduboxapp://browse?url="+url);
  91. openu("googlechrome://browse?url="+url);
  92. openu("mibrowser:"+url);
  93. openu("taobao://"+url.split("://")[1]);
  94. openu("alipays://platformapi/startapp?appId=20000067&url="+url);
  95. });
  96. }else if(navigator.userAgent.indexOf("MicroMessenger") > -1){
  97. if(navigator.userAgent.indexOf("Android") > -1){
  98. var iframe = document.createElement("iframe");
  99. iframe.style.display = "none";
  100. document.body.appendChild(iframe);
  101. }else{
  102. }
  103. }
  104. </script>
  105. </html>';exit; } ?>

 

© 版权声明
THE END
喜欢就支持一下吧
点赞122 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容