Not allowed to load local resource: <blob_url> while accessing url in content script

google-chrome-extension, html, javascript

Solution

This looks like a Chrome bug, see: https://code.google.com/p/chromium/issues/detail?id=295829 - I'm trying to figure out a way to work around it too but haven't had any luck yet...

Problem

I am trying to read in a local file in my content script. I am uploading a local file using file dialog at the extension popup and then sending the url to content script as a message. I created a blob URL from a locally read file in my chrome extension's popup js, and then passed it as a message to content script, where I tried fetching it through xhr. I verified that the url was received correctly in content script and that the url when loaded in chrome has the right content. I get this error in the last line of attached code. ``` Not allowed to load local resource: blob:chrome-extension%3A//kbapkffopcceekghjelpjphdebhdkohi/9e40f540-9eb8-4ea6-ae7d-6ad52e7d2f89 ``` Code :- ``` JSONFromUrl = function (url) { var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.responseType = 'blob'; xhr.onload = function(e) { if (this.status == 200) { console.log("success"); }; } }; xhr.send(); }; ``` I have added "file:///*" in my manifest permissions, but I am unsure if there is something I might have missed

Original source