简体   繁体   English

chrome.webRequest跨域禁止重定向到数据的方案:

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

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: 我正在使用chrome.webRequest api拦截xhr并重定向到我在chrome.storage.local中具有的已保存blob并收到此错误:

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." chrome.webRequest api指出“允许重定向到非HTTP方案(例如data :)。”

I've tried adding data:* or : to the permissions in the manifest with no luck. 我试过将data:*或添加到清单中的权限,但没有运气。

Redirecting to data: -URIs is fully supported by the webRequest API (and you don't need the non-existent data:* permission for it). 重定向到data: webRequest API完全支持-URIs(并且您不需要不存在的data:*权限)。

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). 您的请求失败,因为直到Chrome 39才支持通过XMLHttpRequest进行data:-URI访问。(从Chrome 39开始,您将能够获取data: -使用XMLHttpRequest的URI,有关更多信息,请参见http://crbug.com/308768 )。

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

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