Chrome notification
var notification = webkitNotifications.createNotification(
'icon.png',
'title',
'text"
);
notification.show();
//cancel it after 5 seconds.
setTimeout(function(){
notification.cancel();
},5000);
In manifest.json:
"permissions": [
"notifications"
],
"web_accessible_resources": [
"icon.png"
]
Written by dennis zhuang
Related protips
2 Responses
Worth saying that this could also be used in webpages, you'll need to add permission handling with: window.webkitNotifications.checkPermission() and window.webkitNotifications.requestPermission().
Note: You must try this using a server request (it won't work with a file:// URL )
A complete example can be found here: http://www.html5rocks.com/en/tutorials/notifications/quick/
regards!
over 1 year ago
·
Yes,i've read your post before,thanks.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Chrome
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#