Created
January 28, 2024 12:34
-
-
Save kphanipavan/3cf043725d422dc8226fc350b993326a to your computer and use it in GitHub Desktop.
pwaOffline.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- flutter_service_worker.js.bak 2024-01-28 17:40:14.621116939 +0530 | |
+++ flutter_service_worker.js 2024-01-28 17:41:33.479719944 +0530 | |
@@ -1,4 +1,5 @@ | |
'use strict'; | |
+const BASE_HREF = "IIITB_Menu/"; | |
const MANIFEST = 'flutter-app-manifest'; | |
const TEMP = 'flutter-temp-cache'; | |
const CACHE_NAME = 'flutter-app-cache'; | |
@@ -123,12 +124,13 @@ | |
if (key.indexOf('?v=') != -1) { | |
key = key.split('?v=')[0]; | |
} | |
- if (event.request.url == origin || event.request.url.startsWith(origin + '/#') || key == '') { | |
+ if (event.request.url == origin || event.request.url.startsWith(origin + '/#') || key == '' || key == BASE_HREF) { | |
key = '/'; | |
} | |
// If the URL is not the RESOURCE list then return to signal that the | |
// browser should take over. | |
- if (!RESOURCES[key]) { | |
+ var resKey = key.replace(BASE_HREF, ""); | |
+ if (!RESOURCES[resKey]) { | |
return; | |
} | |
// If the URL is the index.html, perform an online-first request. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment