Friday, 9 June 2023

Go to an already opened tab when a Chrome Notification is clicked

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?



from Go to an already opened tab when a Chrome Notification is clicked

No comments:

Post a Comment