chrome.webRequest cross-origin disallowed scheme on redirect to data:

烈酒焚心 提交于 2019-12-11 10:37:21

问题


I'm using chrome.webRequest api to intercept xhr's and redirect to a saved blob i have in chrome.storage.local and get this error:

XMLHttpRequest cannot load http://test.com/bla.xml. The request was redirected
to a URL ('data:text/xml;base64,sdfkldsfjdslfjsfsjf') which has a disallowed 
scheme for cross-origin requests.

the chrome.webRequest api states that "Redirections to non-HTTP schemes such as data: are allowed."

I've tried adding data:* or : to the permissions in the manifest with no luck.


回答1:


Redirecting to data:-URIs is fully supported by the webRequest API (and you don't need the non-existent data:* permission for it).

Your requests failed because data:-URI access through XMLHttpRequest was not supported until Chrome 39. (Starting in Chrome 39, you will be able to fetch data:-URIs using XMLHttpRequest, see http://crbug.com/308768 for more info).



来源:https://stackoverflow.com/questions/24171162/chrome-webrequest-cross-origin-disallowed-scheme-on-redirect-to-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!