I am using the code found in this answer to generate a desktop notification, but I can't figure out how to get it to take me back to the page when I click on the notification.
The default behavior is to move the focus to the viewport of the notification's related browsing context.
But when I click on the notification without specifying an onclick
, it just closes the notification. When I try using window.focus()
it also just closes the notification.
You can see my altered code here. I added a setTimeout
to allow me to switch tabs before it fires, and removed the onclick
event.
I'm using chrome 59 on macOS serria if that matters.