Reputation:
Was messing around with Firefox browser extensions today, but came across an issue. I was trying out the notifications, but I am getting the error
"TypeError: "browser.notifications is undefined"
My manifest.json
is requesting the notifications
permission. I am using browser.notifications.create
No notification is showing up.
Any ideas? Apologies if this is a simple question.
Upvotes: 1
Views: 999
Reputation:
Turns out the issue was that I was trying to run the notification from my content script, didn't even realize. Notifications must be sent from a background script. Thanks!
Upvotes: 2
Reputation: 3297
What you need is Notification API
To check the current permission
Notification.permission
To create Notification
new Notification("Hi there!");
I recommend you have a look on the API first
Upvotes: 2