Reputation: 70
I was previousely using webkit notifications on my website but it seems to have deprecated, I am trying the rich notifications but they seem to be not working either. I tried almost all the available demos online but none of them work. Are the Rich notifications deprecated, if so what could be the possible ways of displaying desktop notifications in chrome. I checked the chrome flags and I coudnt find the rich notifications options.
This was the code I was trying for rich notifications
setInterval(timedpopup, 1000);
function timedpopup(){
chrome.notifications.create('report',{
type:'basic',
title:'hello world',
iconUrl: '',
message:'this is a message',
expandedMessage:'Hello World!!!!!!!!!',
priority:1,
buttons:[{title:'Cancel'},{title:'Got it'}],
isClickable:true
},function(){});
}
This gives the error: Uncaught TypeError: Cannot read property 'create' of undefined This is the code that was working earlier:
setInterval(timedpopup, 2000);
function timedpopup(){
webkitNotifications.createNotification("", "This is a message", "HELLO WORLD").show();
}
This gives error: Uncaught ReferenceError: webkitNotifications is not defined
I tried to check it on the chrome documentation but it doesnt say anything about rich notifications being deprecated.
Please let me know if there are any alternatives for notifications. Any input on this context is appreciated
Thanks
Upvotes: 0
Views: 3326
Reputation: 77523
Rich Notifications are not deprecated. However, they are only usable inside a Chrome Extension/App and are not exposed to normal websites.
One can make a "companion" extension for a website that will provide access to Chrome APIs, but that would require asking users to install it.
The direct replacement for webkitNotifications
is indeed HTML5 Notification
.
Upvotes: 2
Reputation: 5368
See: Chrome webkitNotification not found : api missing
And: https://developer.chrome.com/extensions/notifications
And Finally, under "Chrome Notes" https://developer.mozilla.org/en/docs/Web/API/notification
Upvotes: -1