I have this code below for a service worker, its primary purpose was for it
to serve an offline page when the user is offline, it works ok as intended
but the problem its causing now is that its preventing forms from
submitting & other pages from opening!! Its javascript but i was hoping to
get help from this platform nonetheless
*'use strict';var cacheVersion = 1;var currentCache = { offline:
'offline-cache' + cacheVersion};const offlineUrl =
'//off_line';this.addEventListener('install', event => { event.waitUntil(
caches.open(currentCache.offline).then(function(cache) { return
cache.addAll([ '/offline_Image.png',
'/sesoa_banner.png', '/bootstrap.min.css',
'/web2py-bootstrap3.css', '/mystyle.css', offlineUrl
]); }) );});this.addEventListener('fetch', event => { // request.mode
= navigate isn't supported in all browsers // so include a check for
Accept: text/html header. if (event.request.mode === 'navigate' ||
(event.request.method === 'GET' &&
event.request.headers.get('accept').includes('text/html'))) {
event.respondWith( fetch(event.request.url).catch(error => {
// Return the offline page return
caches.match(offlineUrl); }) ); } else{ // Respond
with everything else if we can
event.respondWith(caches.match(event.request)
.then(function (response) { return response ||
fetch(event.request); }) ); }*
});
Regards
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/af7c70dc-b0a2-4140-b1ab-0c3ef5476ea3n%40googlegroups.com.