I am trying to update my extension but I get following error message. Message clear but there is no line 30. What is the problem?
manifest.json
{
"name": "IdeaShop Information",
"description": "IdeaShop siteleri ile ilgili bilgileri gosterir",
"manifest_version": 2,
"version": "1.0",
"permissions": [
"tabs",
"http://*/*",
"https://*/*"
],
"browser_action": {
"default_title": "IdeaShop Information",
"default_icon": "icon.png",
"popup": "popup.html"
}
]
}
Directory Structure
There seems to be an extra ] at the end.
You can validate your json file at jsonlint.com
An extra square bracket at the last but one line caused the error. The line number displayed in such message is not correct.
Related
On load of some page I getting alert (SyntaxError: "[object Object]" is not valid JSON)
But in anonymous mode all clear, so it given by Chrome extensions.
Is there a fast way to check what it is, other then going by exclusion method?
First you have to check your extension in chrome://extension and see if it shows any error on pointed location
enter image description here
if any error button shown here! than click on it to resolve error!
and [object object] is not valid json!
you can write only one value in these brackets []:
//its a right json format
"objects":["objects"]
and all of this json writes in this two brackets! {}
Here is Example of My Extension Manifest file!
{
"name": "Notify!",
"description": "A Google Chrome extension!",
"version": "1.7",
"manifest_version": 3,
"icons": {
"128": "/assets/icons/128.png",
"48": "/assets/icons/128.png",
"16": "/assets/icons/128.png"
},
"action": {
"default_icon": "/assets/icons/128.png",
"default_popup": "popup.html",
"default_title": "It's my title"
},
"background":{
"script": ["eventPage.js"]
//"service_worker": false
},
"content_scripts":[
{
"matches": ["http://*.google.com/*"],
"js": ["content.js","jquery-3.6.1.min.js"]
}
],
"permissions": [
"tabs",
"http://*.google.com/*"
]
}
I was getting errors while trying to upload a chrome extension because I had to update the manifest to version 3. I was using a JSON error checker but it was confusing. I'm pulling my hair out over this and would be cool if someone could help me thanks!
(By the way I've never really done much JSON before so don't blame me)
{
"manifest_version": 3,
"name": "FreeRice AutoFarm",
"description": "AutoFarm rice at freerice.com.",
"version": "1",
"author": "Dex",
"icons": {
"48": "favicon48.png",
"128": "favicon128.png",
"256": "favicon256.png"
},
"permissions": [
"tabs",
"activeTab",
],
"host_permissions" : [
"http://freerice.com/*",
"https://freerice.com/*",
"http://*.freerice.com/*",
"https://*.freerice.com/*"
]
"action": {
"default_popup": "popup.html",
"default_icon": "favicon48.png",
"default_title": "FreeRice AutoFarm"
}
}
This is my first attempt writing a Chrome extension. I added "web_accessible_resources": ["images/icon.png"] to manifest.json because I wanted to access the image from content script. After adding this line, I got the error "Invalid value for 'web_accessible_resources[0]'.
Could not load manifest." I have checked to make sure the file path is correct, where else could I be wrong?
Any help is appreciated.
{
"name": "Bookmark Checker",
"version": "1.0",
"manifest_version": 3,
"permissions": [
"bookmarks",
"activeTab"
],
"background": {
"service_worker": "background.js"
},
"content_scripts": [
{
"matches":["https://www.google.com/search?*"],
"js": ["content/content.js"]
}
],
...
"web_accessible_resources": ["images/icon.png"]
}
The syntax for web_accessible_resources in Manifest V3 has changed:
"web_accessible_resources": [{
"resources": ["/images/icon.png"],
"matches": ["<all_urls>"]
}]
The matches key must specify where to expose these resources since Chrome 89.
When I tried to upload the zip file, it shows 'manifest.json:26:1: unknown syntax error'
My json file:
{
"manifest_version": 2,
"name": "Real French Toast",
"version": "0.0.1",
"description": "hahaha",
"browser_action": {
"default_icon": "RealFrenchToast.png",
"default_popup": "popup.html",
"default_title": "Click here!"
},
"background": {
"scripts": ["background.js"],
"persistent": false
},
"permissions": [
"tabs",
"activeTab",
"https://ajax.googleapis.com/"
]
}
Thanks in advance.
I've tried installing a dummy extension with this manifest successfully. BTW the file has only 25 lines. Apparently your manifest.json has a bad character on the last line. You may investigate it in a hex viewer/editor.
Fix: copypaste the contents into a new file and save it as manifest.json overwriting the old file.
XMLHttpRequest cannot load http://localhost:4567/save. Origin chrome-extension://cbemaelkkmebiohhjgmlclegalijdbbh is not allowed by Access-Control-Allow-Origin.
Even thought I'm getting this error the extension seems to be calling the URL. The message passing from contentscript.js to background.html took me a few minutes to wire up, but seems ok. I'm confused.
Here is my manifest.
{
"name": "FirstExt",
"version": "1.0",
"description": "My First Extension",
"browser_action": {
"default_icon": "icon.png",
"popup": "popup.html"
},
"content_scripts": [
{
"matches": ["http://*"],
"js": ["jquery.min.js", "contentscript.js"]
}
],
"background_page": "background.html",
"permissions": [ "http://*",
"http://localhost:4567/*" ]
}
Try changing http://* to http://*/ (and removing the localhost entry).
If you're trying to access a https page, you will need that too.
Replace "http://*" with "<all_urls>".