I want send notification by Google Chrome Extension
Manifest
{
"name": "Test",
"description": "Test",
"version": "1.1",
"background": {
"scripts": ["background.js"]
},
"permissions": [
"tabs", "http://*/*", "https://*/*",
"notifications"
],
"browser_action": {
"default_title": "Test",
"default_icon": "test_16x16.png"
},
"manifest_version": 2
}
background.js
chrome.browserAction.onClicked.addListener(function() {
chrome.notifications.create(
'name-for-notification',{
type: 'basic',
iconUrl: 'image.jpeg',
title: "This is a notification",
message: "hello there!"
},
function() {}
);
});]
Why doesn't it work?
Related
I'm developing a google chrome extension. I need to get the active tab window function. and update the window function. But can't get the active tab window function.
chrome.tabs.query({ active: true, currentWindow: true }, tabs => {
chrome.scripting.executeScript({
target: { tabId: tabs[0].id! },
function: () => {
console.log(window);
}
})
});
Manifest.json
{
"name": "Dummy Extension",
"version": "1.0",
"description": "Build an Extension with Angular",
"manifest_version": 3,
"permissions": [
"tabs",
"activeTab",
"scripting"
],
"background": {
"service_worker": "background.js"
},
"action": {
"default_title": "Chrome extension",
"default_popup": "index.html"
},
"host_permissions": [
"http://localhost:8004/*",
"https://localhost:8004/*"
]
}
I'm trying to create a extension for Firefox that inserts a predefined text into the textbox by clicking on an option in the contextmenu.
I wrote the following code but it does not work:
function insert(text) {
document.getElementById('textbox').innerHTML = "THE TEXT I WANT";
}
chrome.contextMenus.create({
title: "TITLE", onclick: insert});
The manifest is also as follows:
"manifest_version": 2,
"name": "NAME",
"description": "DESCRIPTION",
"version": "1",
"author": "ME",
"homepage_url": "https://github.com",
"icons": {
"48": "icons/48.png",
"96": "icons/96.png"
},
"permissions": [
"activeTab",
"contextMenus",
"webNavigation"
],
"browser_action": {
"default_icon": {
"48": "icons/48.png",
"96": "icons/96.png"
},
"default_title": "TITLE"
},
"background": {
"scripts": [
"extension.js"
]
}
Thanks for your help.
We're developing a web extension. We're actually trying to add some functionalities on the extension such as notifications.
For instance, we don't see any notifications at all, not even in the log console and we can't figure out the problem.
Do you have any ideas ?
Here is our manifest and our background.
Thank you in advance.
{
"description": "truc écolo",
"manifest_version": 2,
"name": "PolNum",
"version": "0.1",
"icons": {
"48": "icons/icon48.png"
},
"permissions": [
"webRequest",
"activeTab",
"http://*/*",
"https://*/*",
"tabs",
"*://*.google.com/",
"storage",
"alarms",
"history",
"notifications"
],
"browser_action": {
"default_popup" :"popup.html",
"default_icon": {
"16": "icons/icon16.png",
"32": "icons/icon32.png"
}
},
"background": {
"scripts": ["background.js"]
}
}
chrome.notifications.create('test', {
type: 'basic',
iconUrl: "icons/icon16N.png",
title: 'Test Message',
message: 'You are awesome!',
priority: 2
});
I've followed some tutorials, but for some reason I'm not able to see the extension I added when I right-click.
manifest.json file
{
"name": "name",
"description": "description",
"version": "1.0",
"manifest_version": 3,
"permissions": [
"contextMenus"
],
"background.service_worker": {
"scripts": ["eventPage.js"],
"persistent": false
},
"action": {
"default_icon": "icon.png"
},
"icons": {
"16" : "icon.png"
}
}
eventPage.js file
var contextMenuItem = {
"id": "id",
"title": "title",
"contexts": ["selection"]
}
chrome.contextMenus.create(contextMenuItem);
"manifest_version": 3,
"background": {
"service_worker": ""eventPage.js"
}
//OTHERWISE
"manifest_version": 2,
"background": {
"persistent": false,
"scripts": ["eventPage.js"]
},
I want my Chrome Extension to read and display all http requests in alerts. But alerts are not displaying, console is clear with no errors. Here is my code:
chrome.webRequest.onBeforeRequest.addListener(
function(details) {
alert(JSON.stringify(details));
},
{urls: ["<all_urls>"]},
["blocking", "requestBody"]
);
Also my manifest:
{
"manifest_version": 2,
"name": "Some_Name",
"version": "1.2",
"content_scripts": [{"matches": ["<all_urls>","http://*/*", "https://*/*"],"js": ["background.js"]}],
"background": {
"page": "background.html"
},
"permissions": [
"alarms",
"webRequest",
"webRequestBlocking"
],
"browser_action": {
"default_title": "Some extension"
},
"icons": {
"128": "icon.png" }
}