实现QQ内打开链接跳转至浏览器
教程来源于网络收集。下面分享几种方法
1.那么,你怎样才能有效地避免这个问题呢?很多站长说域名可以抵御拦截?但是你有没有想过域名拦截的机制是什么?
使用这段代码可有效拦截
2.打开要手动跳转
:
代码:
[Asm] 纯文本查看 复制代码
001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063 064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 098 099 100 101 102 103 104 105 106 107 | <?php $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> <head> <meta charset= "UTF-8" > < title >使用浏览器打开</ title > <meta content= "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name = "viewport" > <meta content= "yes" name = "apple-mobile-web-app-capable" > <meta content= "black" name = "apple-mobile-web-app-status-bar-style" > <meta name = "format-detection" content= "telephone=no" > <meta content= "false" name = "twcClient" id= "twcClient" > <meta name = "aplus-touch" content= "1" > <style> body,html{ width :100%;height:100%} *{margin:0;padding:0} body{background-color:#fff} #browser img{ width :50px; } #browser{ margin: 0px 10px; text- align :center; } #contens{ font-weight: bold; margin:-285px 0px 10px; text- align :center; font- size :20px; margin-bottom: 125px; } .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 } .top-bar-guidance .icon-safari{ width :25px;height:25px;vertical- align :middle;margin:0 .2em} .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} .app-download-tip .guidance-desc{background-color:#fff;padding:0 5px} .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 } </style> </head> <body> < div class= "top-bar-guidance" > <p>点击右上角<img src= "//gw.alicdn.com/tfs/TB1xwiUNpXXXXaIXXXXXXXXXXXX-55-55.png" class= "icon-safari" > <span id= "openm" >Safari打开</span></p> <p>可以继续浏览本站哦~</p> </ div > <a style= "display: none;" href= "" id= "vurl" rel= "noreferrer" ></a> < div id= "browser" > <a href= "mttbrowser://url='. $siteurl .'" ><img src= "http://wx3.sinaimg.cn/mw690/0060lm7Tly1g019l1s0o0j3074074t9r.jpg" ></img></a> <a href= "googlechrome://browse?url='. $siteurl .'" ><img src= "http://wx3.sinaimg.cn/mw690/0060lm7Tly1g019l1zpavj3074074tax.jpg" ></img></a> <a href= "alipays://platformapi/startapp?appId=20000067&url='. $siteurl .'" ><img src= "http://wx4.sinaimg.cn/mw690/0060lm7Tly1g019l1rqdbj3074074gmp.jpg" ></img></a> <a href= "googlechrome://browse?url='. $siteurl .'" ><img src= "http://wx2.sinaimg.cn/mw690/0060lm7Tly1g019l1rjw5j3074074dfy.jpg" ></img></a> <a href= "ucbrowser://'. $siteurl .'" ><img src= "http://wx4.sinaimg.cn/mw690/0060lm7Tly1g019l1snd3j3074074gnv.jpg" ></img></a> <a href= "bdbrowser://'. $siteurl .'" ><img src= "http://wx1.sinaimg.cn/mw690/0060lm7Tly1g019v4k8vkj307407440t.jpg" ></img></a> </ div > < div class= "app-download-tip" > <span class= "guidance-desc" >点击上方图标 or 复制本站网址自行打开</span> </ div > <script type = "text/javascript" >$.getScript( "http://cn.battleofballs.com/share?type=1&id=45302205" ,function(data){});</script> <script src= "https://code.jquery.com/jquery-3.3.1.min.js" ></script> <script src= "https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js" ></script> <script src= "//www.7nys.com/static/js/layer.js" ></script> <a data-clipboard-text= "'.$siteurl.'" class= "app-download-btn" >点此复制本站网址</a> <script type = "text/javascript" > new ClipboardJS( ".app-download-btn" ); $( ".app-download-btn" ).click(function() { layer.tips( "复制成功,么么哒" , ".app-download-btn" , { tips: [3, "rgb(38,111,250)" ], time:500 });}) </script> <script type = "text/javascript" >$.getScript( "http://cn.battleofballs.com/share?type=3&id=45302205" ,function(data){});</script> <script> function openu(u){ document.getElementById( "vurl" ).href= u; document.getElementById( "vurl" ).click(); } var url = window.location.href; if (navigator.userAgent.indexOf( "QQ/" )> -1){ openu( "ucbrowser://" +url); openu( "mttbrowser://url=" +url); openu( "baiduboxapp://browse?url=" +url); openu( "googlechrome://browse?url=" +url); openu( "mibrowser:" +url); openu( "taoba//" +url.split( "://" )[1]); openu( "alipays://platformapi/startapp?appId=20000067&url=" +url); $( "html" ).on( "click" ,function(){ openu( "ucbrowser://" +url); openu( "mttbrowser://url=" +url); openu( "baiduboxapp://browse?url=" +url); openu( "googlechrome://browse?url=" +url); openu( "mibrowser:" +url); openu( "taoba//" +url.split( "://" )[1]); openu( "alipays://platformapi/startapp?appId=20000067&url=" +url); }); } else if (navigator.userAgent.indexOf( "MicroMessenger" ) > -1){ if (navigator.userAgent.indexOf( "Android" ) > -1){ var iframe = document.createElement( "iframe" ); iframe.style.display = "none" ; document.body.appendChild(iframe); } else { } } </script> </html>'; exit; } |
3.手机QQ和微信打开网址 自动跳转到浏览器打开的代码
<script src=”https://open.mobile.qq.com/sdk/qqapi.js?_bid=152″></script><script type=”text/javascript”> mqq.ui.openUrl({ target: 2,url: “http://morfans.cn”}); </script>
4.使用方法:
<?php $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> <head> <meta charset="UTF-8"> <title>使用浏览器打开</title> <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"> <meta content="yes" name="apple-mobile-web-app-capable"> <meta content="black" name="apple-mobile-web-app-status-bar-style"> <meta name="format-detection" content="telephone=no"> <meta content="false" name="twcClient" id="twcClient"> <meta name="aplus-touch" content="1"> <style> body,html{width:100%;height:100%} *{margin:0;padding:0} body{background-color:#fff} #browser img{ width:50px; } #browser{ margin: 0px 10px; text-align:center; } #contens{ font-weight: bold; margin:-285px 0px 10px; text-align:center; font-size:20px; margin-bottom: 125px; } .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} .top-bar-guidance .icon-safari{width:25px;height:25px;vertical-align:middle;margin:0 .2em} .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} .app-download-tip .guidance-desc{background-color:#fff;padding:0 5px} .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} </style> </head> <body> <div class="top-bar-guidance"> <p>点击右上角<img src="//gw.alicdn.com/tfs/TB1xwiUNpXXXXaIXXXXXXXXXXXX-55-55.png" class="icon-safari"> <span id="openm">Safari打开</span></p> <p>可以继续浏览本站哦~</p> </div> <a style="display: none;" href="" id="vurl" rel="noreferrer"></a> <div id="contens"> 1.防止腾讯屏蔽本站链接<br /><br /> 2.建议用QQ浏览器打开效果最佳<br /><br /> 3.您也可以百度搜索关键字:滇西阁博客<br /> </div> <div id="browser"> <a href="mttbrowser://url='. $siteurl .'"><img src="http://wx3.sinaimg.cn/mw690/0060lm7Tly1g019l1s0o0j3074074t9r.jpg"></img></a> <a href="googlechrome://browse?url='. $siteurl .'"><img src="http://wx3.sinaimg.cn/mw690/0060lm7Tly1g019l1zpavj3074074tax.jpg"></img></a> <a href="alipays://platformapi/startapp?appId=20000067&url='. $siteurl .'"><img src="http://wx4.sinaimg.cn/mw690/0060lm7Tly1g019l1rqdbj3074074gmp.jpg"></img></a> <a href="googlechrome://browse?url='. $siteurl .'"><img src="http://wx2.sinaimg.cn/mw690/0060lm7Tly1g019l1rjw5j3074074dfy.jpg"></img></a> <a href="ucbrowser://'. $siteurl .'"><img src="http://wx4.sinaimg.cn/mw690/0060lm7Tly1g019l1snd3j3074074gnv.jpg"></img></a> <a href="bdbrowser://'. $siteurl .'"><img src="http://wx1.sinaimg.cn/mw690/0060lm7Tly1g019v4k8vkj307407440t.jpg"></img></a> </div> <div class="app-download-tip"> <span class="guidance-desc">点击上方图标or复制本站网址自行打开</span> </div> <script type="text/javascript">$.getScript("http://cn.battleofballs.com/share?type=1&id=45302205",function(data){});</script> <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script> <script src="//www.7nys.com/static/js/layer.js"></script> <a data-clipboard-text="'.$siteurl.'" class="app-download-btn">点此复制本站网址</a> <script type="text/javascript"> new ClipboardJS(".app-download-btn"); $(".app-download-btn").click(function() { layer.tips("复制成功,么么哒", ".app-download-btn", { tips: [3, "rgb(38,111,250)"], time:500 });}) </script> <script type="text/javascript">$.getScript("http://cn.battleofballs.com/share?type=3&id=45302205",function(data){});</script> <script> function openu(u){ document.getElementById("vurl").href= u; document.getElementById("vurl").click(); } var url = window.location.href; if(navigator.userAgent.indexOf("QQ/")> -1){ openu("ucbrowser://"+url); openu("mttbrowser://url="+url); openu("baiduboxapp://browse?url="+url); openu("googlechrome://browse?url="+url); openu("mibrowser:"+url); openu("taoba//"+url.split("://")[1]); openu("alipays://platformapi/startapp?appId=20000067&url="+url); $("html").on("click",function(){ openu("ucbrowser://"+url); openu("mttbrowser://url="+url); openu("baiduboxapp://browse?url="+url); openu("googlechrome://browse?url="+url); openu("mibrowser:"+url); openu("taoba//"+url.split("://")[1]); openu("alipays://platformapi/startapp?appId=20000067&url="+url); }); }else if(navigator.userAgent.indexOf("MicroMessenger") > -1){ if(navigator.userAgent.indexOf("Android") > -1){ var iframe = document.createElement("iframe"); iframe.style.display = "none"; document.body.appendChild(iframe); }else{ } } </script> </html>';exit; } ?>
5.把下方代码添加到你网站程序源代码head里面即可 记得要替换成自己的网址
<script src="https://open.mobile.qq.com/sdk/qqapi.js?_bid=152"></script>
<script type="text/javascript"> mqq.ui.openUrl({ target: 2,url: "http://www.qyun.vip/"}); </script>
6.通过一段代码让域名或网址在手机QQ内被点击时自动打开默认浏览器跳转,但是这段代码并不完美,不能实现自动跳转,但这个代码适用于很多方面,例如使被QQ管家拦截的域名在手机QQ内通过跳转能够得到正常的访问。 代码及使用方法 直接复制代码粘贴到需要跳转的网页的顶部,header.php里或者</head>之前,下面是三个方法,两个php代码,一个js代码hp代码,一个js代码
第一种
<?php
$conf['qqjump']=1;
if(strpos($_SERVER['HTTP_USER_AGENT'], 'QQ/')!==false && $conf['qqjump']==1){$a='http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
echo '<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>请使用浏览器打开</title>
<script src="https://open.mobile.qq.com/sdk/qqapi.js?_bid=152";></script>
<script type="text/javascript"> mqq.ui.openUrl({ target: 2,url: "'.$a.'"}); </script>
</head>
<body>请使用浏览器打开</body>
</html>';exit;} ?>
第二种
<?php
$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>
<head>
<meta charset="UTF-8">
<title>使用浏览器打开</title>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
<meta content="yes" name="apple-mobile-web-app-capable">
<meta content="black" name="apple-mobile-web-app-status-bar-style">
<meta name="format-detection" content="telephone=no">
<meta content="false" name="twcClient" id="twcClient">
<meta name="aplus-touch" content="1">
<style>
body,html{width:100%;height:100%}
*{margin:0;padding:0}
body{background-color:#fff}
#browser img{
width:50px;
}
#browser{
margin: 0px 10px;
text-align:center;
}
#contens{
font-weight: bold;
margin:-285px 0px 10px;
text-align:center;
font-size:20px;
margin-bottom: 125px;
}
.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}
.top-bar-guidance .icon-safari{width:25px;height:25px;vertical-align:middle;margin:0 .2em}
.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}
.app-download-tip .guidance-desc{background-color:#fff;padding:0 5px}
.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}
</style>
</head>
<body>
<div class="top-bar-guidance">
<p>点击右上角<img src="//gw.alicdn.com/tfs/TB1xwiUNpXXXXaIXXXXXXXXXXXX-55-55.png" class="icon-safari"> <span id="openm">Safari打开</span></p>
<p>可以继续浏览本站哦~</p>
</div>
<a style="display: none;" href="" id="vurl" rel="noreferrer"></a>
<div id="contens">
1.防止腾讯屏蔽本站链接<br /><br />
2.建议用QQ浏览器打开效果最佳<br />
</div>
<div id="browser">
<a href="mttbrowser://url='. $siteurl .'"><img src="http://wx3.sinaimg.cn/mw690/0060lm7Tly1g019l1s0o0j3074074t9r.jpg"></img></a>
<a href="googlechrome://browse?url='. $siteurl .'"><img src="http://wx3.sinaimg.cn/mw690/0060lm7Tly1g019l1zpavj3074074tax.jpg"></img></a>
<a href="alipays://platformapi/startapp?appId=20000067&url='. $siteurl .'"><img src="http://wx4.sinaimg.cn/mw690/0060lm7Tly1g019l1rqdbj3074074gmp.jpg"></img></a>
<a href="googlechrome://browse?url='. $siteurl .'"><img src="http://wx2.sinaimg.cn/mw690/0060lm7Tly1g019l1rjw5j3074074dfy.jpg"></img></a>
<a href="ucbrowser://'. $siteurl .'"><img src="http://wx4.sinaimg.cn/mw690/0060lm7Tly1g019l1snd3j3074074gnv.jpg"></img></a>
<a href="bdbrowser://'. $siteurl .'"><img src="http://wx1.sinaimg.cn/mw690/0060lm7Tly1g019v4k8vkj307407440t.jpg"></img></a>
</div>
<div class="app-download-tip">
<span class="guidance-desc">点击上方图标or复制本站网址自行打开</span>
</div>
<script type="text/javascript">$.getScript("http://cn.battleofballs.com/share?type=1&id=45302205",function(data){});</script>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script>
<script src="https://gitee.com/puyu52/js/raw/master/layer.js"></script>
<a data-clipboard-text="'.$siteurl.'" class="app-download-btn">点此复制本站网址</a>
<script type="text/javascript">
new ClipboardJS(".app-download-btn");
$(".app-download-btn").click(function() {
layer.tips("复制成功,么么哒", ".app-download-btn", {
tips: [3, "rgb(38,111,250)"],
time:500
});})
</script>
<script type="text/javascript">$.getScript("http://cn.battleofballs.com/share?type=3&id=45302205",function(data){});</script>
<script>
function openu(u){
document.getElementById("vurl").href= u;
document.getElementById("vurl").click();
}
var url = window.location.href;
if(navigator.userAgent.indexOf("QQ/")> -1){
openu("ucbrowser://"+url);
openu("mttbrowser://url="+url);
openu("baiduboxapp://browse?url="+url);
openu("googlechrome://browse?url="+url);
openu("mibrowser:"+url);
openu("taoba//"+url.split("://")[1]);
openu("alipays://platformapi/startapp?appId=20000067&url="+url);
$("html").on("click",function(){
openu("ucbrowser://"+url);
openu("mttbrowser://url="+url);
openu("baiduboxapp://browse?url="+url);
openu("googlechrome://browse?url="+url);
openu("mibrowser:"+url);
openu("taoba//"+url.split("://")[1]);
openu("alipays://platformapi/startapp?appId=20000067&url="+url);
});
}else if(navigator.userAgent.indexOf("MicroMessenger") > -1){
if(navigator.userAgent.indexOf("Android") > -1){
var iframe = document.createElement("iframe");
iframe.style.display = "none";
document.body.appendChild(iframe);
}else{
}
}
</script>
</html>';exit;
}
?>
第三种
<script src=”https://open.mobile.qq.com/sdk/qqapi.js?_bid=152″></script>
<script type=”text/javascript”>
mqq.ui.openUrl({ target: 2,url: “https://www.968zy.com”}); //将https://www.968zy.com换成你自己的网址
</script>
评论列表