[英]How can I enable cross-origin AJAX requests between my chrome extension and my Node server?
In my background.js
script, I'm making vanilla AJAX GET request using the XMLHttpRequest()
object to my Node server (currently hosted on localhost
). 在我的
background.js
脚本中,我正在使用XMLHttpRequest()
对象向我的节点服务器(当前托管在localhost
)发出vanilla AJAX GET请求。 The Node server is using the npm package express
to handle the GET request. Node服务器使用npm package
express
来处理GET请求。 However, background.js
just returns the error: 但是,
background.js
只返回错误:
Access to XMLHttpRequest at 'localhost:80' from origin 'chrome-extension://jhccmehanjenpnjalilnihdmeignbcpn' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
Is it a permission I need to include in the manifest.json
or something? 这是我需要包含在
manifest.json
的权限吗? Thanks! 谢谢!
@wOxxOm solved my problem in the comment above! @wOxxOm在上面的评论中解决了我的问题! I just forgot the
http://
我刚忘了
http://
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.