
有时需要这个功能,对于一些手册网站,离线保存网页效果又不好时。
可以创建一个简单的 HTML 文件,双击后在默认浏览器中打开指定的网址(甚至是自动跳转)。以下是几种 HTML 实现方式:
方法 1:纯 HTML 自动跳转(最快)
html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=https://docs.espressif.com/projects/esp-dev-kits/zh-cn/latest/other/esp-prog/user_guide.html">
<title>ESP-Prog 文档</title>
</head>
<body>
<p>正在跳转到 <a href="https://docs.espressif.com/projects/esp-dev-kits/zh-cn/latest/other/esp-prog/user_guide.html">ESP-Prog 文档</a>...</p>
</body>
</html>
说明:
meta http-equiv="refresh"
会让浏览器 立即跳转 (content="0"
表示 0 秒后跳转)。- 备份链接 (
<a>
标签) 确保即使跳转失败也能手动点击访问。 - 保存方式 :复制代码 → 用记事本保存为
ESP-Prog_Docs.html
→ 双击打开。
方法 2:JavaScript 跳转(可选)
html
<!DOCTYPE html>
<html>
<head>
<title>ESP-Prog 文档</title>
<script>
window.location.href = "https://docs.espressif.com/projects/esp-dev-kits/zh-cn/latest/other/esp-prog/user_guide.html";
</script>
</head>
<body>
<p>如果未自动跳转,请<a href="https://docs.espressif.com/projects/esp-dev-kits/zh-cn/latest/other/esp-prog/user_guide.html">点击这里</a>。</p>
</body>
</html>
说明:
- 使用
window.location.href
实现 JS 跳转,效果与方法 1 类似。