技术连接
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>跳转到微信金山文档</title>
<style>
/* 弹框样式 */
#popup {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 20px;
background-color: white;
border: 1px solid #ccc;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
text-align: center;
z-index: 9999;
}
/* 按钮样式 */
#popup button {
padding: 10px 20px;
margin: 10px;
font-size: 16px;
cursor: pointer;
}
#popup button:hover {
background-color: #f0f0f0;
}
/* 背景遮罩 */
#overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 9998;
}
</style>
</head>
<body>
<!-- 背景遮罩 -->
<div id="overlay"></div>
<!-- 弹出框 -->
<div id="popup">
<p>是否打开微信金山文档?</p>
<button id="openButton">打开</button>
<button id="cancelButton">取消</button>
</div>
<script>
// 页面加载时自动弹出弹框
window.onload = function() {
setTimeout(function() {
document.getElementById("popup").style.display = "block";
document.getElementById("overlay").style.display = "block";
}, 500); // 延迟500ms后显示弹框
};
// 打开按钮点击事件
document.getElementById("openButton").onclick = function() {
// 微信金山文档单个文档页面链接
const wechatLink = "weixin://dl/officialaccounts?scene=10000000&need_open_webview=1&url=https://open.weixin.qq.com/";
// 通过微信的 URL Scheme 打开金山文档
window.location.href = wechatLink;
};
// 取消按钮点击事件
document.getElementById("cancelButton").onclick = function() {
document.getElementById("popup").style.display = "none";
document.getElementById("overlay").style.display = "none";
};
</script>
</body>
</html>