Answer the question
In order to leave comments, you need to log in
How does VKontakte display a message when the tab is not active?
When a message arrives on vk.com, even if I'm reading Habr right now, a message pops up at the bottom right.
I wanted to know how they did it.
if (typeof window.webkitNotifications == 'undefined') {
console.log('Notifications API не поддерживается вашим браузером.');
} else {
if (webkitNotifications.checkPermission() != 0) {
webkitNotifications.requestPermission();
}
var notification=webkitNotifications.createNotification('icon.png', 'Заголовок', 'Проверка Notifications API');
notification.show();
}
Answer the question
In order to leave comments, you need to log in
It's a fun thing - notifications in Google Chrome.
support.google.com/mail/bin/answer.py?hl=ru&answer=1075549
And on/off - vk.com/im At the
bottom there is "Enable / Disable Notifications"
I've never seen anything like this, are you sure it's JS and not a browser add-on?
Just like gmail =)
But the contact itself doesn’t seem to know how, it’s more like an add-on (MusicSig?)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question