<!DOCTYPE html>
<html>
<head>
<title>禁止电脑访问,只允许手机访问</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
background-color: #f1f1f1;
text-align: center;
padding: 20px;
}
.button {
display: inline-block;
background-color: #4CAF50;
color: #fff;
padding: 10px 20px;
font-size: 16px;
border: none;
cursor: pointer;
border-radius: 4px;
transition: background-color 0.3s;
}
.button:hover {
background-color: #45a049;
}
</style>
<script>
// 检测设备类型
function detectDeviceType() {
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
if (/android/i.test(userAgent)) {
return "android";
}
if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
return "ios";
}
return "other";
}
// 页面加载完成后执行重定向逻辑
window.onload = function() {
var deviceType = detectDeviceType();
if (deviceType === "other") {
window.location.href = "http://kaiyuanya.top/404.html"; // 重定向到不支持访问的页面
}
};
</script>
</head>
<body>
<h1>适配手机界面的按钮点击跳转</h1>
<button class="button" onclick="location.href='https://www.kaiyuanya.top/';">点击跳转</button>
</body>
</html>禁止电脑访问,只允许手机访问
admin
HTML源码
279
免责声明
1.软件源码资源来源于网络,如有侵权请联系我们!
2.侵权联系邮箱:48165603@qq.com 收到邮件的24小时内删帖!
3.资源开源分享均为网络资源,开源发布立场不代表本站!
4.请勿侵犯正版软件,尊重正版版权作者的劳动成果!
5.欢迎广大开发作者来本站投稿,开源鸭有你更精彩!
同类推荐
