I have a javascript application that shows notifications regularly. When a notification is clicked, I want it to focus on the tab/window that my application is currently running. I can get that behavior working fine with this code:
var options = {
body: msg.body,
sticky: true,
icon : 'img/logo_quad.png',
tag: id,
renotify : true
};
var notification = new Notification(msg.title,options);
notification.onclick = function(){
window.focus();
};
However, if I have two tabs running this same application at once, when I click it, instead of focusing one of the two tabs it opens a new tab with the same URL.
Why is that happening and how can I prevent it?
Note: A chrome only solution is welcome, I don't care about other browsers