feat(pwa): 实现PWA支持,支持离线访问
- 添加 manifest.json 文件配置PWA应用信息 - 创建 Service Worker (sw.js) 实现资源缓存与离线访问 - 在HTML中引入PWA相关meta标签及注册代码 - 更新项目文档结构说明,增加PWA相关文件描述 - 移除冗余CSS样式并优化页面加载逻辑 - 调整Google Analytics和51.LA统计脚本加载方式 - 完善部署文档中的PWA自定义配置说明
This commit is contained in:
35
about.html
35
about.html
@@ -5,6 +5,10 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
|
||||
<title>关于我 - Honesty</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<!-- PWA相关配置 -->
|
||||
<meta name="theme-color" content="#6c5ce7">
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
|
||||
<!--SEO信息 -->
|
||||
<meta name="description" content="关于Honesty,关于HeHouHui,关于HeHui,关于明厚, About Me Honesty, About Me HeHouHui, About Me HeHui">
|
||||
<meta name="keywords" content="Honesty,HeHouHui,HeHui,明厚">
|
||||
@@ -41,6 +45,8 @@
|
||||
<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/artalk/2.9.1/Artalk.css">
|
||||
<link rel="stylesheet" href="css/artalk.css?version=20251125">
|
||||
<link rel="icon" href="favicon.ico">
|
||||
<link rel="apple-touch-icon" href="./images/logo.png">
|
||||
|
||||
<!--IE淘汰计划-->
|
||||
<script>
|
||||
if (/*@cc_on!@*/false || (!!window.MSInputMethodContext && !!document.documentMode)) window.location.href = "https://imsyy.top/upgrade-your-browser/index.html?referrer=" + encodeURIComponent(window.location.href);
|
||||
@@ -424,5 +430,34 @@
|
||||
initFormatter();
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- PWA注册 -->
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function() {
|
||||
navigator.serviceWorker.register('/js/sw.js')
|
||||
.then(function(registration) {
|
||||
console.log('SW registered: ', registration);
|
||||
})
|
||||
.catch(function(registrationError) {
|
||||
console.log('SW registration failed: ', registrationError);
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Apple PWA支持 -->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<meta name="apple-mobile-web-app-title" content="Honesty">
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
||||
|
||||
<!-- Windows PWA支持 -->
|
||||
<meta name="msapplication-TileImage" content="/images/avatar.jpeg">
|
||||
<meta name="msapplication-TileColor" content="#6c5ce7">
|
||||
<meta name="msapplication-tap-highlight" content="no">
|
||||
|
||||
<!-- 其他PWA相关meta标签 -->
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user