Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

javascript - Chrome webkitNotification not found : api missing

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...