GoogleChromeLabs / web-push-codelab

Other
556 stars 291 forks source link

Chrome push test does not display push notification #41

Closed bo-brainlabs closed 7 years ago

bo-brainlabs commented 7 years ago

I've followed the tutorial up to the "Handle a push event section". At the end of this section, I click the chrome devtools "Push" button, but no push notification is displayed on screen. The service worker "sw.js" is executed as I can see the console log output and it reads:

[Service Worker] Push Received.
[Service Worker] Push had this data: "Test push message from DevTools."

But no push notification. I'm using a 2013 macbook air running 10.12.3 & Chrome version 57

Is this just something I've done wrong or is this a common problem?

gauntface commented 7 years ago

I've not come across anyone experiencing this before. Maybe try unregistering the service worker and refreshing the page and going through it again, in case the service worker is just out of date.

bo-brainlabs commented 7 years ago

Hi @gauntface I found that refreshing it didn't seem to work, but using your demo site https://gauntface.github.io/simple-push-demo/ works like a charm...

Actually pasting that link in the terminal created a push notification and displayed all the test push notifications that didn't previously work...

So it's almost as if the notifications were waiting to be triggered by something else. Any ideas?

I'll keep digging and hopefully find the problem when I fully understand how the service worker is doing it's thing.

gauntface commented 7 years ago

It may be that Chrome was strugging to connect to GCM. Will close for now - but please comment if there is anything you discover that I should add or change to the codelab.

bo-brainlabs commented 7 years ago

Thanks!

albanx commented 6 years ago

Having same issue following the same tutorial. The push button from Chrome dev tools does not work

vtkhanh commented 6 years ago

I got the same problem now :(

portal7 commented 6 years ago

Same issue, Button "Push" from DevTools not works ("focus" link button did not too)

zenghj commented 6 years ago

Same issue :(

mqtsuo02 commented 6 years ago

This issue has been reported as a bug in Developer Tools. https://github.com/GoogleChromeLabs/web-push-codelab/issues/49

GitPawel commented 5 years ago

Guys! It works on Google Canary: I have: v. 73.0.3628.0 (official version) canary (32-bits)

factcondenser commented 5 years ago

Hopefully this helps someone else who googles their way to this thread:

Notification.tag seems to behave differently between Firefox and Chrome. To see what I mean, visit this supremely helpful push notification examples site (thanks for creating that, @gauntface!) in Firefox and click the first demo button entitled 'Example Notification'. Close the notification that appears and click the button again. You should receive a second notification. Now, repeat that process in Chrome. Unless I'm missing something, you should only have received one notification that appears after the first click. Subsequent clicks don't cause more notifications to appear. Removing the tag entry from the options hash (line 42 of notification-examples.js) causes the button to behave the same way in both Firefox and Chrome.

In conclusion, if you, like me, were confused as to why your push notifications weren't showing up in Chrome, check whether you're passing a tag in the options hash to RegistrationServiceWorker.showNotification().

danduongfr commented 3 years ago

Had the same issue on Apple MacPro. Had to authorize notification for Chrome in Apple System Preferences.

Screen Shot 2020-10-29 at 3 09 57 PM