Chrome extension fails to load when I add icons - google-chrome-extension

I've been learning how to make a Chrome extension and have been stuck on just adding an icon for a while now, I've copy pasted code that supposedly works but I keep getting this error:
Could not load icon 'icon16.png' specified in 'icons'.
Could not load manifest.
My code:
{
"manifest_version": 3,
"name": "extension",
"description": "test",
"version": "1.0",
"browser_action": {
"default_icon": "icon48.png"
},
"icons": {
"16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png"
},
"content_scripts": [
{
"js": [
"test.js"
],
"matches": [
"https://www.test.com/*"
]
}
]
}
I've triple checked that every image is in fact a PNG and is of the right size. I have a single directory with manifest.json, test.js, and all three images (as well as a.prettierrc file, although I doubt that has any impact).
If I remove the icons part of manifest.json the extension works perfectly.

The error about not being able to load the manifest is likely related to:
"browser_action": {
"default_icon": "icon48.png"
},
which is from Manifest Version 2. The "browser_action" field should be changed to:
"action": {
"default_icon": "icon48.png"
},
For further reference see here: Action API unification

Related

Default Icons in manifest for Chrome Extension

I have this piece of code in my manifest:
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html",
"default_icon": {
"16": "images/16x16.png",
"48": "images/48x48.png",
"128": "images/128x128.png"
}
},
It was working fine until today and now I am getting a 'duplicate key' error.
I know there are two entries for default_icon -- one for the old way of declaring a single icon, and the new way for declaring for specific sizes -- however it was not causing an issue when uploading the new packages until now. Did something change?
If I remove the first declaration, what that cause any issues?
Update:
I'm now getting an error where I can upload the zip file now, but publishing fails with 'Internal Publish Error'. When I first upload the zip, I did get a warning 'Invalid Manifest Content' but no other details. All of this was working until recently. Here is my manifest:
{
"web_accessible_resources": [
"files/*",
"js/languages.json"
],
"name": "Workspace Manager",
"version": "0.962",
"manifest_version": 2,
"short_name": "Workspace Tab Manager extension.",
"description": "Tab Manager and Productivity Extension - save tabs as workspaces and revisit them in the future",
"icons": {
"16": "images/16x16.png",
"48": "images/48x48.png",
"128": "images/128x128.png"
},
"background": {
"scripts": ["background.js"],
"persistent": false
},
"browser_action": {
"default_icon": {
"16": "images/16x16.png",
"48": "images/48x48.png",
"128": "images/128x128.png"
},
"default_popup": "popup.html"
},
"permissions": [
"tabs",
"storage"
],
"content_security_policy": "script-src 'self' https://ajax.googleapis.com https://ssl.google-analytics.com https://www.googletagmanager.com; object-src 'self'"
}
It turns out that duplicate keys are no longer allowed. And to fix it, you not only need to delete one of the duplicates (as I did), but you need to unpublish your extension entirely and then republish.
It wasn't clear on what would happen when unpublishing. Essentially, you extension will disappear from the Webstore and when you republish, it takes longer than usual to review it. (it took about 2 days vs the normal couple hours). In that time it will say 'pending' but when it does get approved, everything in your store will be restored and it will be as though nothing happened.

How to remove the "read and change all your data..." warning for Chrome Extension?

I have created a Chrome extension and published it to the Chrome Web Store. I noticed with my initial version that when a user tried to install it they would get the warning that my extension could "read and change all your data on the websites you visit". I've changed and republished my extension so that I don't think that warning should be displayed, but it still gets displayed. Based on the information at https://developer.chrome.com/extensions/permission_warnings I don't think that message should be showing up. Below is what is in my manifest.json file. Any suggestions for how to make the warning go away?
{
"name": "Screen Recorder",
"description": "Record a video of your computer screen",
"version": "0.4",
"manifest_version": 2,
"icons": {
"16": "icon.png",
"128": "icon.png"
},
"background": {
"scripts": [
"background.js",
"ourrecorder.js"
]
},
"browser_action": {
"default_icon": "icon.png",
"default_popup": "receiver.html"
},
"permissions": [
"desktopCapture",
"tabCapture",
"notifications",
"unlimitedStorage"
]
}

Microsoft Edge Extension Toolbar Action Button Icon not visible

I have used the "Microsoft Edge Extension Toolkit" (https://www.microsoft.com/en-us/store/p/microsoft-edge-extension-toolkit/9nblggh4txvb) to convert the chrome extension code to be compatible with MS Edge browser.
Enabled the "Developer Settings" from "about:flags" and loaded the newly converted code.
Everything works well except the icon in the toolbar. Its a "browserAction" (https://developer.microsoft.com/en-us/microsoft-edge/platform/documentation/extensions/api-support/supported-APIs/) button .
It is showing the default icon by the browser even after trying out a lot of icons but no luck.
Does anyone have any idea about any option though which the icon can be set or the image type required.
Tried installing other extensions and their icon is clearly visible.
Any ideas?
Edit:
Here is the manifest.json file content: The contents are not changed after conversion.
{
"manifest_version": 2,
"name": "............",
"description": "............",
"version": "1.0",
"author": "............",
"browser_action": {
"default_icon": {
"16": "data/images/icon-16.png",
"32": "data/images/icon-32.png",
"48": "data/images/icon-48.png",
"64": "data/images/icon-64.png",
"128": "data/images/icon-128.png"
},
"default_title": "............"
},
"icons": {
"16": "data/images/icon-16.png",
"32": "data/images/icon-32.png",
"48": "data/images/icon-48.png",
"64": "data/images/icon-64.png",
"128": "data/images/icon-128.png"
},
"background": {
"scripts":[
"background.js"
],
"persistent": false
},
"content_scripts": [
{
"run_at": "document_end",
"matches": ["http://*/*", "https://*/*"],
"css": [
"data/css/style.css"
],
"js": [
"data/js/script.js"
]
}
],
"permissions": [
"tabs",
"activeTab",
"contextMenus",
"http://*/*",
"https://*/*"
],
"web_accessible_resources": [
"data/images/icon-16.png",
"data/images/icon-32.png",
"data/images/icon-48.png",
"data/images/icon-64.png",
"data/images/icon-128.png"
]
}
To add more to this, the icons are properly scaled to the sizes mentioned in the file.
I got lucky with a sample extension code that I found after a long time that actually worked.
The manifest.json file had this one setting:
"browser_action": {
"default_icon": {
"20": "data/images/icon-20.png"
},
"default_title": "................"
},
In other browsers the image size of 16, 24, 32, 48 and 128 works well but this particular browser requires a 20x20 size, surprisingly.
Hope this helps someone.
browser_action Microsoft Edge does not support the following syntax: browser_action : {"default_icon" : "icon.png" }
Size for icons must be specified.
Preferred sizes: 20px, 25px, 30px, 40px.
Other supported sizes: 19px, 35px, 38px.
Here's the documentation https://developer.microsoft.com/en-us/microsoft-edge/platform/documentation/extensions/api-support/supported-manifest-keys/

URL with fragment chrome extensions

I have a little problem whit my chrome extension.
The extension works if I'm on a URL that not uses fragment.
Now sure on how to configure it.
Im trying with definition < all_urls > but as I wrote. it does not work on pages with fragment.
manifest.json
{
"update_url": "https://clients2.google.com/service/update2/crx",
"name": "Analytic Live Alarm",
"version": "0.3",
"description": "Felipe the solution provider",
"permissions": [
"tabs","<all_urls>"
],
"browser_action": {
"default_icon": "icon.png"
},
"icons": {
"16": "icon.png",
"48": "icon.png",
"128": "icon_128.png"
},
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"run_at": "document_end" ,
"js": ["jquery.min.js", "script.js"]
}
],
"manifest_version":2
}
This is the url Im using.
https://www.google.com/analytics/web/#dashboard/6I8yfVs_TqSQ_b1tOJYR0Q/a8398197w15972131p74378741/
Any ideas?
Thanks
Taking into account your previous question..
It's not "not working", it's working once; then, as you navigate, the page is not really reloaded, and your script does not run again.
Instead of coloring all elements at document_end, you need to detect new elements that match your selector and re-apply your styles.
This question should help you get started, or better yet mutation-summary library.

Google Chrome Extension -- Declared icons in manifest.json won't load

I'm building my second chrome extension, and can't get the icons to load in development mode; everything is still a puzzle piece in chrome. I have triple-checked the path and that they are each the correct size. Any ideas on why they won't load? Here is the manifest.json
manifest.json:
{
"manifest_version": 2,
"name": "Wishlist",
"short_name": "Add things to your wishlist.",
"version": "1.0",
"browser_action": {
"default_title": "Wishlist",
"default_icon": "icons/16x16.png"
},
"icons": {
"16": "icons/16x16.png",
"48": "icons/48x48.png",
"128": "icons/128x128.png"
}
}

Resources