Reputation: 11
I can't tell what's wrong with this code:
In my listener on background.js I have the following
if (request=="notify") {
chrome.notifications.create({title: "Title", message: "There is an time slot available", iconUrl: "icon.png",type: "basic"});;
}
and in my content_script.js I call it using this:
chrome.runtime.sendMessage("notify");
Notifications are enabled, but nothing is popping up. In my manifest.json I have
"permissions": [ "notifications", "tabs", "activeTab", "background" ],
Any help you can provide is much appreciated.
Upvotes: 1
Views: 1675
Reputation: 3192
The following code in background.js
chrome.notifications.create({title: "Title", message: "There is an time slot available", iconUrl: "icon.png", type: "basic"})
with the following manifest
{
"manifest_version": 2,
"name": "Test",
"description": "Hello!",
"version": "1.0",
"permissions": [
"notifications", "tabs", "activeTab", "background"
],
"background": {
"scripts": ["background.js"]
}
}
Therefore I assume your issue to be either:
Upvotes: 1