用html+jq+css 写个检测并且提示如果域名在微信或者QQ中引导用户复制链接到手机浏览器浏览
<!DOCTYPE html>
<html>
<head>
<title>检测微信、QQ域名</title>
<meta charset="utf-8">
<style type="text/css">
#msg {
margin-top: 20px;
font-size: 16px;
color: red;
display: none;
}
</style>
</head>
<body>
<h1>检测微信、QQ域名</h1>
<p>请输入要检测的域名:</p>
<input type="text" id="domain">
<button id="check">检测</button>
<p id="msg">该域名在微信或QQ中,请复制链接到手机浏览器浏览。</p>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script type="text/javascript">
$(function() {
$('#check').click(function() {
var domain = $('#domain').val();
if (domain.indexOf('http://') == 0 || domain.indexOf('https://') == 0) {
domain = domain.substring(domain.indexOf('//') + 2);
}
if (domain.indexOf('/') != -1) {
domain = domain.substring(0, domain.indexOf('/'));
}
if (domain.indexOf('weixin.qq.com') != -1 || domain.indexOf('qq.com') != -1) {
$('#msg').show();
} else {
alert('该域名不在微信或QQ中。');
}
});
});
</script>
</body>
</html>
原文地址: http://www.cveoy.top/t/topic/berZ 著作权归作者所有。请勿转载和采集!