sciactive / pnotify

Beautiful JavaScript notifications with Web Notifications support.
https://sciactive.com/pnotify/
Apache License 2.0
3.65k stars 513 forks source link

How to focus the tab that generate the notifications desktop #300

Closed shaviiman closed 7 years ago

shaviiman commented 7 years ago

How to focus the tab that generate the desktop notification, without window.alert()?

PNotify.desktop.permission();
(new PNotify({
    title: 'Desktop Success',
    text: 'If you\'ve given me permission, I\'ll appear as a desktop notification. If you haven\'t, I\'ll still appear as a regular PNotify notice.',
    type: 'success',
    desktop: {
        desktop: true
    }
})).get().click(function(e) {
    if ($('.ui-pnotify-closer, .ui-pnotify-sticker, .ui-pnotify-closer *, .ui-pnotify-sticker *').is(e.target)) return;
    **alert('Hey! You clicked the desktop notification!');**
});

These methods do not work

parent.focus();
window.focus();
hperrin commented 7 years ago

Did you figure out a way?