HTML Notification

Dec 5 2012 5:00 PM DEC 5 2012 5:00 PM
Web browser Notifications / Webkit NotificationsJavascript | HTML | HTML5

Chrome and Safari both have HTML Notifications now via webkit. Firefox does have something similar to this but I haven't researched to much into it. A quick test to demonstrate what it can do below... 

 

document.getElementById("allowNotification").onclick=function(){
	
		if(document.getElementById("allowNotification").value == "Allow Notification"){
			window.webkitNotifications.requestPermission(function(){
					document.getElementById("allowNotification").value = "Push Notification";
					if (window.webkitNotifications.checkPermission() == 0) {
						window.webkitNotifications.createNotification(
							"/public/images/shaun_s.ico", 
							"Shaunware Tutorial",
							"This is a Notification from your Web Browser.").show();
					}
			});
		}else{
				window.webkitNotifications.createNotification(
					"/public/images/shaun_s.ico", 
					"Shaunware Tutorial",
					"This is a notification triggered by a button.").show();

		}
	}