Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 821
gvijay Avatar asked Oct 23 '25 17:10

gvijay


1 Answers

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

like image 157
brucek Avatar answered Oct 26 '25 06:10

brucek