Another Cross-XHR related

后端 未结 1 1059
南笙
南笙 2021-01-28 23:26

I know that there\'s a bunch of questions about the \"not allowed by Access-Control-Allow-Origin.\" error.

But I\'ve tried some of them without success. :(

Some

1条回答
  •  温柔的废话
    2021-01-29 00:03

    I've got it!

    Actually, the problem is that I'm trying to perform XHR requests on devtools page and it seems to have no permissions to bypass cross-origin-access policies like a popup page do.

    Devtools tab tries are also unsuccessful.

    edit

    Is an stage-permission related. Not wildcard-permission. As I've said, I've managed to perform queries on some domains, yet not having they explicitly on my permissions array.

    The problem really lies on the type of script running.

    The same script, if used as a popup, work'd fine. So, I've tried as an background-script with success too! I was facing the problem that devtools_page and related doesn't have such permissions...

    The APIs available to extension pages within the Developer Tools window include all devtools modules listed above and chrome.extension API. Other extension APIs are not available to the Developer Tools pages, but you may invoke them by sending a request to the background page of your extension, similarly to how it's done in the content scripts.

    http://developer.chrome.com/extensions/devtools.html

    That level of script denies non explicit cross xhrs.

    Solved the problem putting the requests in a background script and using messages api.

    Thank you!

    0 讨论(0)
提交回复
热议问题