4

I am developing a alert notification extension using AngularJS. It fetches alerts from a REST api and shows noification (webkitNotifications). It was all good on my laptop (where I was developing) but hell broke when I sifted to my desktop for testing. I now get error :

ReferenceError: webkitNotifications is not defined
at chrome-extension://dncdcpdlbnnhncggaenbpknljjbmdlpo/js/background.js:156:5
at chrome-extension://dncdcpdlbnnhncggaenbpknljjbmdlpo/js/angular.min.js:72:169
at E (chrome-extension://dncdcpdlbnnhncggaenbpknljjbmdlpo/js/angular.min.js:100:258)
at E (chrome-extension://dncdcpdlbnnhncggaenbpknljjbmdlpo/js/angular.min.js:100:258)
at E (chrome-extension://dncdcpdlbnnhncggaenbpknljjbmdlpo/js/angular.min.js:100:258)
at chrome-extension://dncdcpdlbnnhncggaenbpknljjbmdlpo/js/angular.min.js:102:5
at h.$eval (chrome-extension://dncdcpdlbnnhncggaenbpknljjbmdlpo/js/angular.min.js:112:179)
at h.$digest (chrome-extension://dncdcpdlbnnhncggaenbpknljjbmdlpo/js/angular.min.js:109:268)
at h.$apply (chrome-extension://dncdcpdlbnnhncggaenbpknljjbmdlpo/js/angular.min.js:113:7)
at g (chrome-extension://dncdcpdlbnnhncggaenbpknljjbmdlpo/js/angular.min.js:72:337) angular.min.js:92

Laptop : v34.0.1847.116 m

Desktop : v35.0.1916.69 beta-m

ultimate
  • 658
  • 1
  • 8
  • 18

1 Answers1

5

The old notification API has been depreciated and now, it's suggested to use Rich Notifications. The implementation is pretty easy and you shouldn't have any problems with it.

Here is the link to the documentation: go!

You should be aware of Linux version, where rich notifications are available only in dev channel. In stable version, old API is still accessible and may cause several problems when your extension will be used across different systems.

Mike Grabowski
  • 1,955
  • 16
  • 17
  • its giving error -> cannot read property 'create' of undefined !! – Vardan Jun 19 '14 at 15:25
  • 1
    It sounds like you are not calling the notification API from a background script... This API is likely not available in a content script. – smcgregor Jun 30 '14 at 23:13
  • 1
    Actually, it looks like they reshuffled the APIs. This works for me if the app has notifications permission: var notification = new Notification("User message"); – smcgregor Jun 30 '14 at 23:36