Javascript in a web page (not a Chrome app or extension) can create a Chrome desktop notification, and set an URL to be opened when the notification is clicked.
var notification = new Notification('Notification title', {
icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png',
body: "Hey there! You've been notified!"
});
notification.onclick = function () {
window.open("http://stackoverflow.com/a/13328397/1269037");
}
Is it possible to create a notification that, when is clicked, opens the tab which created that notification?
Go to Settings > Privacy and Security > Site Settings, then scroll down to Notifications in the pop-up window that appears. From there, you can toggle the Sites Can Ask to Send Notifications switch that turns website notification prompts on or off.
Under “Privacy and security,” click Site settings. Click Notifications. Choose to block or allow notifications: Allow or Block all: Turn on or off Sites can ask to send notifications.
Yes.
notification.onclick = function () {
window.focus();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With