1
votes

I am trying to follow the instructions from here to enable offline support (Service worker) in my polymer starter kit clone.

However, after making the changes in gulpfile.js, index.html and elements.html, I keep getting the following error whenever I refresh the page. enter image description here

Also if I change the throttling setting to offline in Chrome Developer Tools and refresh, the page comes back with the "Unable to connect to the Internet" message so clearly the caching isn't working.

Is there anything else that I need to do?

Update: Just decoded the url (i.e. http://localhost:5000/bower_components/platinum-sw/platinum-sw-register.html&clientsClaim=true&skipWaiting=true&version=1.0) in the error message and ran it in Chrome and got a 404 error. If I remove everything after .html then the file can be found though.

1
ERR_FILE_EXISTS might be a dup of this one - apparently this is just an alarming way Chrome reports hey - the service worker script did not change - eveything is still OK conditionpirxpilot
Thanks @pirxpilot, this might be it but still doesn't explain why when I turn off the internet the page goes down...Jessica

1 Answers

2
votes

I was having the same issue and turned out it's because the platinum-sw-cache is set to disabled in the dev development, which means service worker will not work if you run

gulp serve

So to test the PSK offline, you need to call

gulp serve:dist

You can also ignore that ERR_FILE_EXISTS error as explained by @pirxpilot.