1
0
Fork 0
mirror of https://github.com/marcrobledo/RomPatcher.js.git synced 2025-07-17 16:38:31 +00:00

PWA fix attempt 5

This commit is contained in:
Marc Robledo 2019-04-18 12:08:55 +02:00
parent a23fdbec00
commit 7e966df0ec
3 changed files with 7 additions and 7 deletions

View file

@ -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);