Using Workbox's Get Started Guide, I have recently gotten a service worker working on my webapp. However, after adding networkFirst, the app did not register any cached js. However, the service worker needed to be restarted and reloaded before any logs showed up in the console.
After adding CSS caching, when I load my webapp in Chrome using localhost, it crashes. The app does not crash Firefox.
I've posted this to bug reports (sw.js file posted there) but thought I'd try here in case anyone has experiences and solved this, or it's an issue with my files or file structure.
mywebsite
--/static
- sw.js
- index.html
- main.js
- manifest.webmanifest
-- /favicons
- manifest.json
Related
I'm using a node.js local server to serve Chrome a three.js page, and Chrome instead of updating the page when I reload it after I've done some changes, it reloads a cached version instead, and will only update it after I clear all history, then close and re-open the dumb Chrome, which is extremely frustrating and inefficient. That doesn't happen with Firefox. Any ideas?
node.js server run on a .bat file inside the working folder:
http-server -p 8000
exit
on address bar:
http://localhost:8000/mypage.html
Using Chrome 61. iCloud Drive mysteriously seems to have reverted a JavaScript file I worked a long time on to a previous version (before I did a git commit). I had viewed this file repeatedly in Chrome (srced from an html page). Is it possible Chrome still has a copy of this somewhere?
Any other way I could possible recover this file? iCloud Drive doesn't appear to have revision history as I thought (I can only recover deleted files).
Pheww, I got it!
Shut down my web server
Loaded the page in Chrome
Chrome expectedly reported the server refused the connection
Clicked view page source
There it was!
I am running a simple jQuery code (developing a simple webpage), while following a YouTube jQuery & Ajax tutorial. Half way of the tutorial, I was running the index.html file directly from my PC folder on Google Chrome, and console.log("message") worked fine, posting the "message" on Chrome Dev console.
Getting into Ajax territory, the tut suggests running a local Apache Server with XAMPP.
Here is the problem, as the same code doesn't post anything on Chrome Dev console when the index.html is running from localhost throught XAMPP.
PrtSCR of the page loaded from localhost (left) and from file (right)
After a lot of searching I finally found what the problem was!
It was a browser cache issue! (I use Chrome)
So I disabled Chrome Dev cache, and it works fine!
Anonther solution that I found is Cache Killer extension for Chrome, that clears the browsers cache in every page refresh.
When i run my index.html from chrome browser everything works fine but after i created a chrome app from the same files and tried to run the app i get "window.openDatabase is not a function" error.Did i miss something? I've heard that WEBsql is being depreciated but if that's the problem then why is it working on my browser?The only change i made to the folder with my html/js/css files in order to create the chrome app was adding a manifest and a background.js,i also changed window.localstorage with chrome.storage.local
Chrome has refused to support it in apps.
Given that WebSQL is deprecated, it's extremely unlikely that we'd expose the API in new contexts.
It has been noted that you can workaround by using it inside a webview. Here is the relevant issue.
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.
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.
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.