简体   繁体   中英

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:

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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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