3

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?

Community
  • 1
  • 1
Hari Krishnan
  • 5,992
  • 9
  • 37
  • 55

1 Answers1

6

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

Xan
  • 74,770
  • 16
  • 179
  • 206