diff --git a/about.html b/about.html index c107ec6..e5c6d03 100644 --- a/about.html +++ b/about.html @@ -450,10 +450,10 @@ - + - + diff --git a/index.html b/index.html index 22c51d3..1e3deed 100644 --- a/index.html +++ b/index.html @@ -12,33 +12,36 @@ - + - + - + - + - + - + - - + + Honesty的主页 @@ -58,7 +61,6 @@ media="all"> - - + gtag('js', new Date()); + } catch (e) { + console.log("Google Analytics Init 错误", e); + } - - + - - + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/js/sw.js b/js/sw.js index 6824be2..fb9d8db 100644 --- a/js/sw.js +++ b/js/sw.js @@ -1,15 +1,14 @@ // Service Worker for PWA -const CACHE_NAME = 'honesty-home-v1.0.0'; +const CACHE_NAME = 'honesty-home-v1.0.1'; const urlsToCache = [ - '/', - '/index.html', - '/about.html', - '/css/style.css', - '/css/about.css', - '/css/artalk.css', - '/js/config.js', - '/js/main.js', - '/js/about.js' + './index.html', + './about.html', + './css/style.css', + './css/about.css', + './css/artalk.css', + './js/config.js', + './js/main.js', + './js/about.js' ]; // 安装事件 - 缓存资源 @@ -25,6 +24,11 @@ self.addEventListener('install', event => { // 获取事件 - 拦截网络请求 self.addEventListener('fetch', event => { + // 对于非GET请求或者不是同源请求,直接跳过 + if (event.request.method !== 'GET' || !event.request.url.startsWith(self.location.origin)) { + return; + } + event.respondWith( caches.match(event.request) .then(response => {