【JS】最簡單的域名防紅方法,QQ/微信打開網站提示瀏覽器打開


將下面代碼復制到網頁中

<script>
// 跳轉提示
if (is_weixn_qq()) {;
window.location.href = 'https://c.pc.qq.com/middle.html?pfurl=你的域名';
 
}
// 判斷QQUA的代碼無需修改
function is_weixn_qq(){
var ua = navigator.userAgent.toLowerCase();
if(ua.match(/MicroMessenger/i)=="micromessenger") {
return "weixin";
} else if (ua.match(/QQ/i) == "qq") {
return "QQ";
}
return false;
}
</script>

效果:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM