Files
shencaisuan/html/open-browser.html

69 lines
1.7 KiB
HTML

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>请在浏览器中打开</title>
<style>
body {
margin: 0;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #f5f7fb;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
color: #1f2937;
}
.box {
width: min(88vw, 420px);
padding: 34px 26px;
border-radius: 12px;
background: #fff;
box-shadow: 0 12px 40px rgba(15, 23, 42, .12);
text-align: center;
}
h1 {
margin: 0 0 14px;
font-size: 24px;
}
p {
margin: 10px 0;
line-height: 1.7;
font-size: 16px;
color: #4b5563;
}
.tip {
margin-top: 22px;
padding: 14px;
border-radius: 8px;
background: #f3f4f6;
color: #111827;
}
</style>
<script src="../config.js"></script>
</head>
<body>
<div class="box">
<h1>请在浏览器中打开</h1>
<p>当前页面不支持在微信或 QQ 内置浏览器访问。</p >
<div class="tip">
点击右上角菜单,选择“在浏览器中打开”。
</div>
</div>
<script>
const ua = navigator.userAgent || "";
const inApp = /MicroMessenger|QQ\/[0-9]/i.test(ua);
const prefix = "?redirect=";
if (!inApp && location.search.indexOf(prefix) === 0) {
const target = location.search.slice(prefix.length);
if (target && target.charAt(0) === "/" && target.indexOf("//") !== 0) {
NavigationUtil.open(target);
}
}
</script>
</body>
</html>