如果域名发送在微信或者QQ中则引导用户不允许打开本站去手机自带的浏览器打开判断用户正常手机自带流量与PC浏览器打开域名则正常跳转页面使用html+jq+css 完整代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>跳转页面</title>
<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<style>
body{
text-align: center;
padding-top: 100px;
}
h1{
font-size: 36px;
margin-bottom: 30px;
}
button{
padding: 10px 20px;
font-size: 20px;
background-color: #007bff;
color: #fff;
border: none;
cursor: pointer;
}
</style>
</head>
<body>
<h1>请使用手机自带浏览器打开此页面</h1>
<button id="open">点击打开</button>
<script>
var ua = navigator.userAgent.toLowerCase();
var isWechat = ua.indexOf('micromessenger') != -1;
var isQQ = ua.indexOf('qq/') != -1;
if(isWechat || isQQ){
$('#open').on('click', function(){
alert('请使用手机自带浏览器打开此页面');
});
}else{
window.location.href = 'http://www.example.com'; //此处替换为需要跳转的页面链接
}
</script>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/beuq 著作权归作者所有。请勿转载和采集!