Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught ReferenceError: webkitNotifications is not defined

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?

like image 824
Hari Krishnan Avatar asked Feb 26 '26 03:02

Hari Krishnan


1 Answers

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).

like image 137
Xan Avatar answered Feb 28 '26 16:02

Xan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!