1

My extension uses code from external servers in the following manner:

  1. A TXT file containing HTML code resides in a Dropbox account.
  2. The TXT file's contents are retrieved using jQuery ($.get).
  3. After parsing the data as HTML code, it is written as-is onto the current webpage (document.write(plaintext)).

So the current webpage could be any webpage, like "http://current.com" (the domain is actually owned by me, if it matters). The HTML code itself, which is downloaded and then written on the page, references CSS and JS files from other external domains (from other storage accounts that I own).

This used to work fine, because Chrome extensions are allowed to request data from external domains. However, suddenly, in a specific case, it stopped working, and I get errors:

CSS stylesheet from origin [external domain name that stores the CSS file] has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin [current domain] is therefore not allowed access.

What am I missing? Why suddenly can't the extension get the data, like it did before?

I already read the "standard" questions like the following links, and of course the manifest file has <all_urls> in the permissions.

No 'Access-Control-Allow-Origin' header is present on the requested resource

Cross-Origin XMLHttpRequest in chrome extensions

No 'Access-Control-Allow-Origin' header is present on the requested resource.

Community
  • 1
  • 1
Cauthon
  • 674
  • 1
  • 7
  • 16
  • As I understand that CSS file is loaded not by your extension, but by a webpage you overwrote, so maybe the server's CSP settings have been changed? – wOxxOm Aug 04 '16 at 15:18
  • @wOxxOm I just tested this, and if I change the CSS links to their original domains (e.g. Facebook.com), it works fine. Only when they point to my storage server, the error occurs. So if the problem is that it's not the extension who's requesting the data, but the webpage, then there's the cross-origin problem anyway. Why would retrieving the files from Facebook.com work, and not mystorage.com? – Cauthon Aug 04 '16 at 15:23

0 Answers0