Forum Discussion
MichaelGraham2
8 years agoQrew Assistant Captain
Hi Dan
This is my code for the reg.html but I cant get it to activate the service worker?
I installed the Service Worker Detector.
sw3.js and sw4.js are copies of your code with my dbids.
Can you think of what I may be missing?
This is my code for the reg.html but I cant get it to activate the service worker?
I installed the Service Worker Detector.
sw3.js and sw4.js are copies of your code with my dbids.
Can you think of what I may be missing?
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Service Worker Registration Page</title> </head> <body> <script> var dbid = "bjgfg9j2v"; var dbidTable1 = "bjgfg9j4u"; var dbidTable2 = "bkw7ji6y9"; var dbidTable3 = "bmegt73fb"; var dbidTable4 = "bmtwwihdt"; var apptoken = "bi3u4amckdsz9xcqe3ehdbcwxty"; if ("serviceWorker" in navigator) { navigator.serviceWorker.register(dbid + "?a=dbpage&pagename=sw3.js", {scope: dbidTable1}); navigator.serviceWorker.register(dbid + "?a=dbpage&pagename=sw4.js", {scope: dbidTable3}); } </script> </body> </html>
- MichaelGraham28 years agoQrew Assistant CaptainWhen I go to my home page I can see this in the console.
Uncaught SyntaxError: Invalid or unexpected token
bjgfg9j2v?a=dbpage&pagename=reg.html:10
I have Application Tokens ON and even created a new one, but still the same ??? - _anomDiebolt_8 years agoQrew EliteThis is a JavaScript syntax error. The use of the word token is not referring to your application token - it is referring to JavaScript's attempt to parse some expression it does not understand.
Service Workers are supported by evergreen Chrome, FireFox and Opera not IE or Edge. Microsoft made an announcement they are developing Service Workers for Edge but they are just tardy:
https://blogs.windows.com/msedgedev/2016/05/24/fetch-and-xhr-limitations/
https://developer.microsoft.com/en-us/microsoft-edge/platform/status/serviceworker/
What browser are you using? - MichaelGraham28 years agoQrew Assistant CaptainIm using Chrome Dan
- _anomDiebolt_8 years agoQrew EliteYou can share the application with me (use dandiebolt@yahoo.com) if you want and I will debug.
- MichaelGraham28 years agoQrew Assistant Captaininvite sent
- _anomDiebolt_8 years agoQrew EliteThanks for sharing. It is now working. I don't know how you did it but there were those dreaded "replacement characters" in your your files which I manually removed.
- MichaelGraham28 years agoQrew Assistant Captainoh jeez, I even looked for that!
Thanks Dan, thats great.
Looking forward to Day 5 :)