I am new to Chrome app envelopment as well as to javascript and trying to build a notification feature in chrome app with the help of this doc. Below is the cod of my js file
var app=new function(){
var notification = webkitNotifications.createNotification(
'128.png', // icon url - can be relative
'Hello!', // notification title
'Lorem ipsum...' // notification body text
);
notification.show();
};
But it gives me a "Uncaught ReferenceError: webkitNotifications is not defined" error at the second line. How should i define this webkitNotifications?
You're using massively outdated documentation. It even has a big deprecation warning at the top.
webkitNotifications is no more; on the web, it's replaced by the Notifications API, but..
..since you're building a Chrome App, this is not the optimal route. You should be using the chrome.notifications API as a more feature-rich, extension/app only API.
Docs contain a more up to date tutorial on that (still outdated though as the Notification Center is no more).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With