createHTMLNotification() replacement

折月煮酒 提交于 2019-12-23 09:40:09

问题


I created a Chrome extension in which it uses createHTMLNotification() to show a window on top of everything. However, starting from Chrome 28 Google decided to drop createHTMLNotification() entirely (why, Google. Why?). All in a sudden I need to find a replacement.

createHTMLNotification() let me to dynamically change things on the notification. However, I don't think the new Rich Notification let me do that.

Is there any work-around or suggestions? Thanks.


回答1:


The change was actually announced properly on the Chromium-Extensions mailing list. There was apparently some misunderstanding though, it was stated in august last year that it would remain in use for extensions, but that only lasted half a year.

Anyway, the official recommended replacement is the Rich Notifications API. There is no other workaround planned.




回答2:


After a little bit thinking, I still didn't want to be stuck with Google's default layout. So I used the image type notification, and put a generated canvas image on it. I can draw whatever I want, and I also created a little API to update the notification whenever I want. This worked out perfectly for me.

Thank you Google for making everything so complicated...



来源:https://stackoverflow.com/questions/16764882/createhtmlnotification-replacement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!