{
"manifest_version" : 3,
"name" : "Name",
"version" : "3.0.0",
"description" : "Description",
"author" : "Me",
"icons" : {
"16" : "16x16.png",
"32" : "32x32.png",
"128" : "128x128.png"
},
"content_scripts" : [
{
"matches" : ["<all_urls>"],
"run_at" : "document_start",
"js" : ["content-scripts.js"]
}
],
"background" : {
"service_worker" : "background.js"
},
"browser_action": {
"default_popup": "browser-action/index.html",
"default_title": "Name"
},
"host_permissions" : [
"http://*/*",
"https://*/*"
],
"permissions" : [
"webRequest",
"activeTab",
"tabs",
"unlimitedStorage",
"storage",
"background",
"notifications",
"<all_urls>"
]
}
fetch('https://mywebsite.com/config.json').then(() => {
console.log('it worked!');
}).catch(error => {
console.error(error);
});Access to fetch at 'https://mywebsite.com/config.json' from origin 'chrome-extension://dsjfsdkfjdsklfjdskfsdjkflsd' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.Access-Control-Allow-Origin header. This extends to extensions. In this case, site A is extension and site B is mywebsite.com. To fix the warning and allow resource load, you can make your server Access-Control-Allow-Origin: *. Note that this is a very generic value allowing any other site to load this resource. For security purposes, you should use your extension's id instead of *. --
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/bdcea4b6-919d-4079-8473-5ea5506926ea%40chromium.org.
Access-Control-Allow-Origin: *, I agree that is the a possible solution, however the current extension on manifest V2 has been able to access https://mywebsite.com/config.json without adding Access-Control-Allow-Origin: * headers from the server using the extension "background", so I was looking for a solution without needing to make any server changes.To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.