I'm building a teammate finder website, for the game csgo. One thing I can't get working is notifications inside the game. It's probably not doable. My idea is that if you have it enabled, for a period of time people can write you and the page would notify there's people wanting to play with you.
My test notification work with the browser minimized, but notifications are not showed while ingame. is there anyway I can solve this?
This is the code I'm testing foe the notifications.
document.addEventListener('DOMContentLoaded', function () {
if (Notification.permission !== "granted")
Notification.requestPermission();
});
function notifyMe() {
if (!Notification) {
alert('Desktop notifications not available in your browser. Try Chromium.');
return;
}
if (Notification.permission !== "granted")
Notification.requestPermission();
else {
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");
};
}
setInterval(notifyMe,10000);