googlecodelabs / your-first-pwapp

Code associated with Your First Progressive Web App codelab
https://g.co/codelabs/pwa
Apache License 2.0
638 stars 555 forks source link

service worker not Registered :/ #97

Closed asalas91 closed 5 years ago

asalas91 commented 7 years ago

Show message in console

Uncaught (in promise) DOMException: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).

I'm working in localhost... 127.0.0.1 with LAMP server on Elementary Os and Vhost added

Help me, please!

mrbusche commented 7 years ago

What's the url for your ajax call?

asalas91 commented 7 years ago

That happens for not reading correctly... I thought that by registering the service-worker.js the file was automatically created...

asalas91 commented 7 years ago

This is the code where I'm trying to register service but...

// TODO add service worker code here if ('serviceWorker' in navigator) { navigator.serviceWorker .register('./service-worker.js') .then(function() { console.log('Service Worker Registered'); }) .catch(function(err){ console.log('Filed to register', err); }); }

Always falls into the catch :/

asalas91 commented 7 years ago

Well, I was making use of vhost, which is why I got error with the service-worker.js

Before my url was: pwapp.dev/work

now my url is: localhost/pwapp/work/ :/

it's working fine, thanks!

petele commented 5 years ago

Hi!

Thanks for the feedback. I've rewritten the codelab from scratch and believe I have fixed this issue. The code has been updated, and the new guide is now live.

If you find any issues with the new codelab, please let us know!

Thanks!