简体   繁体   English

从Chrome扩展程序发送发布请求(来源?)

[英]Sending Post Request from Chrome Extension (Origin?)

Hi I'm generating a POST XMLHTTPRequest to a remote server, but it's rejecting the post request. 嗨,我正在生成一个POST XMLHTTPRequest到远程服务器,但是它拒绝了发布请求。 With a quick diff, I realize that the origin header of the XMLHTTPRequest from the XMLHTTPRequest I made has origin of chrome-extension://blahblahblahblahablahblah instead of the browser's url as origin. 通过快速的比较,我意识到我制作的XMLHTTPRequest的XMLHTTPRequest的origin头具有chrome-extension:// blahblahblahblahablahblah的起源,而不是浏览器的url作为起源。 Is there a way to issue the request from the correct origin through chrome extension? 有没有办法通过chrome扩展名从正确的来源发出请求? Thanks! 谢谢!

您是否尝试过使用内容脚本发送请求(以解决域问题)?

If you cannot change the headers of the server, the only way to request it is to use jsonp. 如果您无法更改服务器的标头,则请求它的唯一方法是使用jsonp。 You can find more information about this here: What is JSONP all about? 您可以在这里找到关于此的更多信息: JSONP的全部含义是什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM