diff --git a/RomPatcher.js b/RomPatcher.js index c3ae481..529ec0a 100644 --- a/RomPatcher.js +++ b/RomPatcher.js @@ -11,6 +11,11 @@ const HEADERS_INFO=[ const FORCE_HTTPS=true; +/* service worker */ +if(FORCE_HTTPS && location.protocol==='http:') + location.href=window.location.href.replace('http:','https:'); +else if(location.protocol==='https:' && 'serviceWorker' in navigator) + navigator.serviceWorker.register('/RomPatcher.js/_cache_service_worker.js', {scope: '/RomPatcher.js/'}); @@ -155,11 +160,6 @@ function fetchPredefinedPatch(i, doNotDisable){ /* initialize app */ addEvent(window,'load',function(){ - /* service worker */ - if(FORCE_HTTPS && location.protocol==='http:') - location.href=window.location.href.replace('http:','https:'); - else if(location.protocol==='https:' && 'serviceWorker' in navigator) - navigator.serviceWorker.register('_cache_service_worker.js'); /* language */ var langCode=(navigator.language || navigator.userLanguage).substr(0,2); diff --git a/_cache_service_worker.js b/_cache_service_worker.js index 2e136ff..4dfa66f 100644 --- a/_cache_service_worker.js +++ b/_cache_service_worker.js @@ -30,7 +30,7 @@ caches.keys().then(function(cacheNames){ }); var PRECACHE_ID='rom-patcher-js'; -var PRECACHE_VERSION='v2'; +var PRECACHE_VERSION='v3'; var PRECACHE_URLS=[ '/RomPatcher.js/','/RomPatcher.js/index.html', '/RomPatcher.js/manifest.json', diff --git a/index.html b/index.html index 9c12474..faef420 100644 --- a/index.html +++ b/index.html @@ -122,7 +122,7 @@