keep getting this error: "Manifest is not valid JSON. Line: 1, column: 1, Unexpected token." i don't understand what the issue is with my code? here is what i have so far:
{
"manifest_version": 2,
"name": "extension",
"version": "1.0",
"description": "My first Chrome extension.",
"browser_action": {
"default_icon": "icon.jpg",
"popup": "popup.html"
}
}
I added crossorigin attribute its worked.
<link rel="manifest" crossorigin="use-credentials" href="%PUBLIC_URL%/manifest.json" />
I had my manifest.json File Properties set with Build Action: None, in Visual Studio 2010.
Changing, in Visual Studio, to Content ensured the file was transferred when I deployed.
Maybe yours is a similar issue.
Edit
Given my downvote I thought I should expand and say that my point was that, given that at line 1, column 1 there is valid json, it is more likely that you are getting a 404 http response than the actual json file returned.
So maybe the file isn't in the correct place or the server doesn't have permissions or whatever but the above is what had gone wrong with mine. Admittedly it is maybe too specific to what had gone wrong with mine and not definitely what was wrong with yours.
But the general point still stands, it's more likely caused by web server returning an http response for the json file, check the response in the network log in your browser.
Check the Content-Type of manifest.json in the Network tab. This needs to be application/json instead of text/html.
If you have wrong content-type, you may need to configure the settings of your webserver to correctly serve json files.
In my case I had to add it to the nginx sites-enabled file:
location ~* .(jpg|jpeg|gif|png|css|js|ico|xml|svg|json)$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With