问题
I created Chrome extension and it works as I expected. Actually, it periodically sends http request to my server. But when I tried to run it in Firefox, I've got such an error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at <my_server_ip>:8080/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
My application listens for incoming requests at server_ip:8080
For making requests to my server from chrome extension, I add such entry to manifest.json:
"permissions": [
"http://server_ip:8080/*"
],
Suddenly, it doesn't work in Firefox and I can't understand why. I tried a workaround (found in this article):
"permissions": [
"<all_urls>"
],
And the problem with CORS disappeared. But I want to give permissions only to my resourse - server_ip:8080
How I need to put a rule in permissions entry to make extension work in Firefox?
回答1:
To elaborate on wOxxOm's comment you only need this for your URL permission
"permissions": [
"http://server_ip/*"
],
来源:https://stackoverflow.com/questions/41850733/firefox-permission-to-url-doesnt-work-in-browser-extension