ghooghe
11/12/2013 - 12:32 PM

Notify https://developer.mozilla.org/en-US/docs/Web/API/notification

var canNotify = function() {
	if ("Notification" in window) {
		if (Notification.permission === 'granted') {
			return true;
		} else if (Notification.permission !== 'denied') {
			Notification.requestPermission(function (permission) {
				if(!('permission' in Notification)) {
			        Notification.permission = permission;
				}

			    // If the user is okay, let's create a notification
			    if (permission === "granted") {
			    	 return true;
			    }
			});
		}
	}
	return false;
};
var notify = function(message) {
	if (canNotify()) {
		new Notification('Title', {
			tag: 'notification-id',
			body: message,
			icon: 'icon-url'
		});
	}
};