chrome.webRequest重定向到数据的跨源拒绝方案: [英] chrome.webRequest cross-origin disallowed scheme on redirect to data:

查看:511
本文介绍了chrome.webRequest重定向到数据的跨源拒绝方案:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用chrome.webRequest api拦截xhr,并重定向到chrome.storage.local中保存的blob,并得到此错误:

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.

chrome.webRequest api指出允许重定向到诸如data之类的非HTTP方案。

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

我试图在清单中的权限中添加数据:*或。 b

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

推荐答案

重定向到 data: -URI完全由webRequest API支持(并且您不需要需要不存在的 data:* 权限)。

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

您的请求失败,因为数据:-URI访问(从Chrome 39开始,您将能够使用XMLHttpRequest获取 data: -URI,请参阅 http://crbug.com/308768 获取更多信息)。

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.webRequest重定向到数据的跨源拒绝方案:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆