Cross-origin XHR from a user script in Google Chrome

后端 未结 2 884
梦毁少年i
梦毁少年i 2020-12-06 06:03

Has anybody had any luck performing cross origin XHRs from a user script in Google Chrome? The requests go through to the server (I can see them in the logs) but, the

2条回答
  •  猫巷女王i
    2020-12-06 06:14

    As of Chrome 13, you can do cross origin requests in Content Scripts if you included the permission to the website in the manifest.

    A user script in Chrome is a content script. Content scripts cannot make cross-origin XHRs. If you wish to do cross-origin XHRs, it should be done in the extension pages (background, popup, options).

    For more info: http://code.google.com/chrome/extensions/content_scripts.html http://code.google.com/chrome/extensions/xhr.html

提交回复
热议问题