Doesn't work for file:// URLs
Closed this issue · 6 comments
I am not sure, whether this is intended behaviour or I just can't figure out the necessary settings, but I'm unable to disable Firefox' CORS-policy using this addon when trying to use jQuery.load()
with file://
URLs.
Edit: The solution presented in Issue #24 doesn't help.
Firefox 68.0.2 on Mac
This is what the addon generally bypasses:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://***.
This is something that wouldn't be fixed by the addon:
Security Error: Content at http://*** may not load or link to file:///***.
I don't know the specifics of your code and can only assume you're trying to load a local file url from a remote "web" url, which is not something modern browsers will happily let you do.
Also note that the current whitelist is used to filter the page where you are, not the page you're trying to load.
I am trying to load a local file with jQuery.load into a page that is itself loaded locally via file:// URL. The file to be loaded is identified by a relative path.
I don't think CORS would be at play in such a situation.
Does the request actually happen ?
I've done the following quick test and it seems to work.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script>
$(e=>{
$('body').load('./test.txt');
});
</script>
</body>
</html>
I admit I had to check local file url relativity.
File Uri Scheme and Relative Files
Thank you for the support.
I don't get your example to work. The yellow alert in the Firefox console says : CORS Operation blocked ... (Reason: request wasn't http). It refers to https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSRequestNotHttp
One last question before I surrender: Which settings of the plugin did you apply with your working example? Whitelist entries?
I don't even need to enable the addon for this piece of code to work but that might be because I use Waterfox. Testing on the latest Firefox gives me that same CORS error.
I don't think this is something this addon can solve since the local fetch doesn't even trigger an actual
request.
This might be your best chance:
Firefox 68: local files now treated as cross-origin; is there a way to override?
Thank you once again for your helpful answers.