Chrome Rich Notifications for Extensions Only?

2020-05-09 09:04发布

问题:

I have a page that I would like to enhance by using Chrome's Rich Notifications. The pages I've read however, seem to imply that this API is only available to Chrome extensions. Is this the case? I would love to take advantage of the API, but I don't want to invest the time in converting my web application into a Chrome extension unless absolutely necessary.

Thanks!

回答1:

I does seem that without writing an extension for your webapp, or converting your webapp into a full (packaged) Chrome App, you cannot get access to chrome.notifications.

I've tried to make a Hosted App with "notifications" permission in the manifest, but that only grants access to HTML5 Notification without asking the user. Same goes for background pages.

Your best bet is to make a minimalistic extension that your page can communicate with. Once that is published, you can advertise the extension to your users with Inline Install.