Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

webextension: how to notify a user from content or background script

36 views
Skip to first unread message

quaz...@gmail.com

unread,
Jul 13, 2016, 5:28:16 PM7/13/16
to
I need to be able to alert user from content script.
Right now I am using chrome.notifications.create which works fine in options script but nowhere else.
How can I notify user from content script?
Or if that's not possible, I know how to send a message to the background script ... how would I notify user from there?

Thanks in advance.

Jorge Villalobos

unread,
Jul 13, 2016, 7:13:24 PM7/13/16
to
You can communicate with the background script, which is the one that
has the privileges to notify the user:

https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts#Communicating_with_background_scripts

Jorge

Andrew McKay

unread,
Jul 13, 2016, 7:31:30 PM7/13/16
to Jorge Villalobos, dev-ext...@lists.mozilla.org
I think you asked this in #webextensions too, but for completeness
sake repeating here. It should also work from a background script,
here's an example:

https://github.com/mdn/webextensions-examples/tree/master/notify-link-clicks-i18n
> _______________________________________________
> dev-extensions mailing list
> dev-ext...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-extensions

quaz...@gmail.com

unread,
Jul 14, 2016, 12:12:09 AM7/14/16
to
Unfortunately, the example is not working. I will file a bug.
0 new messages