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"]
},
Related
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.
I'm building a chrome extension and I have commands set in my manifest.json file as follows:
{
"manifest_version": 2,
"name": "Project X",
"description": "Quick lanch Project X",
"version": "0.0.1",
"icons": { "128": "icon_128.png" },
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": ["activeTab"],
"background":
{
"scripts": ["popup.js"],
"persistent": true
},
"commands": {
"execute-browser-action": {
"suggested_key": {
"default": "Ctrl+Shift+Y",
"mac": "Command+Shift+Y"
},
"description": "Toggle feature foo"
}
}
}
My question is: Is it possible to change the default and mac keys (Ctrl+Shift+Y) to something else, during runtime? Specifically decided by the user?
When I try to add some shortcut keyboard for my new extension Chrome, it doesn't work. When I try to check my command with this line :
chrome.commands.getAll(command => { alert(JSON.stringify(command)) })
The description and the name is displaying correctly, but the shortcut property render an empty string. I've tried so many shortcut, delete et re-install my unpackaged extension after that, it doesn't work always.
My manifest.json :
{
"manifest_version": 2,
"name": "myfirstext",
"version": "1.0.0",
"description": "blablabla",
"author": {
"name": "Ben Lmsc",
"url": "https://github.com"
},
"background": {
"scripts": ["js/main.js"]
},
"browser_action": {
"default_popup": "index.html"
},
"commands": {
"handle_my_key": {
"suggested_key": {
"default": "Ctrl+Shift+L"
},
"description": "Description of my shortcut"
}
},
"icons": {
"16": "img/LOGO_16.png",
"32": "img/LOGO_32.png",
"48": "img/LOGO_48.png",
"128": "img/LOGO_128.png"
},
"permissions": [
"http://*/*",
"https://*/*",
"notifications"
]
}
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?
This my manifest:
{
"name": "Test",
"description": "Appliation",
"manifest_version": 2,
"version": "0.1",
"app": {
"background": {
"scripts": ["background.js"]
}
},
"icons": { "16": "phone16.png", "256": "phone256.png" },
"browser_action": {
"default_title": "action description",
"default_icon": "phone20.png"
}
}
But when install this extension browser action icon is not shown.
Is there any problem?
Hoe can I show?
You are declairing a Chrome App, not an extension:
"app": {
...
}
Change the above block to:
"background": {
"scripts": ["background.js"]
}
(I.e. remove the wrapping app property, just leave background.)
Try this Manifest:
{
"name": "Test",
"version": "0.1",
"manifest_version": 2,
"description": "Appliation",
"browser_action": {
"default_title": "Test",
"default_icon": "images/phone19.png",
},
"icons": {
"19": "images/phone19.png",
},
"background": {
"scripts": ["background.js"]
}
}