Local Xml Blocked By Cors Policy
I'm trying to read an XML file using JQuery... Or at the very least, I'm trying to access it. I have a file system made like this : -> Main directory -> html ->
Solution 1:
Different browsers implement Same Origin Policy restrictions for files loaded from the file system in different ways.
Some:
- Block access to all local files
- Block access to all local files except those in the same directory or a subdirectory of the HTML file
CORS Policy shouldn't be blocking me for trying to read a local file.
Yes, it should. This is an important security feature.
You would not want someone sending you an HTML file as an attachment in an email, double-clicking it to open it, and then JavaScript embedded in it reading files from your hard disk and sending them to the person who sent the email.
Is there a way to solve this?
If you want to access local files, then either:
- make your local files available over HTTP. You can run an HTTP server that listens only on the loopback network interface if you don't want to allow access from other computers.
- use a browser which implements the weaker of the two security policies I described and rearrange your file system as you have already discovered
Post a Comment for "Local Xml Blocked By Cors Policy"