Local xml blocked by cors policyHow do I parse XML in Python?How do I comment out a block of tags in XML?What does <![CDATA[]]> in XML mean?Disable same origin policy in ChromeLocal Storage vs CookiesHow Do You Parse and Process HTML/XML in PHP?How to allow CORS?CORS request not going through. Unsure whyHow to use CORS to access Flipkart API?d3.json blocked by CORS policy
How to create ADT in Haskell?
Open a doc from terminal, but not by its name
Biological Blimps: Propulsion
Why electric field inside a cavity of a non-conducting sphere not zero?
Store Credit Card Information in Password Manager?
Is it possible to have a strip of cold climate in the middle of a planet?
When were female captains banned from Starfleet?
How do you make your own symbol when Detexify fails?
What does routing an IP address mean?
Terse Method to Swap Lowest for Highest?
How should I respond when I lied about my education and the company finds out through background check?
Has any country ever had 2 former presidents in jail simultaneously?
Yosemite Fire Rings - What to Expect?
Did arcade monitors have same pixel aspect ratio as TV sets?
Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?
Dealing with a rejection from a journal
Freedom of speech and where it applies
lightning-datatable row number error
Removing files under particular conditions (number of files, file age)
Why does the Sun have different day lengths, but not the gas giants?
Are paving bricks differently sized for sand bedding vs mortar bedding?
Is aluminum electrical wire used on aircraft?
2.8 Why are collections grayed out? How can I open them?
The IT department bottlenecks progress. How should I handle this?
Local xml blocked by cors policy
How do I parse XML in Python?How do I comment out a block of tags in XML?What does <![CDATA[]]> in XML mean?Disable same origin policy in ChromeLocal Storage vs CookiesHow Do You Parse and Process HTML/XML in PHP?How to allow CORS?CORS request not going through. Unsure whyHow to use CORS to access Flipkart API?d3.json 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
-> home.html
-> js
-> jquery.js
-> XMLReader.js (made it myself)
-> XML
-> test.xml
XMLReader.js is made like this :
'use strict'
$(document).ready(function()
$.ajax(
type: "GET",
url: "../xml/test.xml",
//async: false,
dataType: "xml",
success: function(xml)
console.log("ayy");
);
);
When I try to reach my XML file located in my xml folder, my request keeps getting blocked by CORS policy (when I am trying to access a LOCAL file !). On the other hand, if I put all the files in the same directory (and change the links of course), it works.
Basically, CORS policy is preventing me from organising my local web application.
Is there a way to solve this ? CORS Policy shouldn't be blocking me for trying to read a local file, right ?
javascript jquery html xml cors
New contributor
Eox is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
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
-> home.html
-> js
-> jquery.js
-> XMLReader.js (made it myself)
-> XML
-> test.xml
XMLReader.js is made like this :
'use strict'
$(document).ready(function()
$.ajax(
type: "GET",
url: "../xml/test.xml",
//async: false,
dataType: "xml",
success: function(xml)
console.log("ayy");
);
);
When I try to reach my XML file located in my xml folder, my request keeps getting blocked by CORS policy (when I am trying to access a LOCAL file !). On the other hand, if I put all the files in the same directory (and change the links of course), it works.
Basically, CORS policy is preventing me from organising my local web application.
Is there a way to solve this ? CORS Policy shouldn't be blocking me for trying to read a local file, right ?
javascript jquery html xml cors
New contributor
Eox is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
What’s the exact error message the browser is logging in the devtools console?
– sideshowbarker
2 days ago
@sideshowbarker "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///home/alexandre/Bureau/xml/testLayout.xml. (Reason: CORS request not http)."
– Eox
2 days ago
add a comment |
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
-> home.html
-> js
-> jquery.js
-> XMLReader.js (made it myself)
-> XML
-> test.xml
XMLReader.js is made like this :
'use strict'
$(document).ready(function()
$.ajax(
type: "GET",
url: "../xml/test.xml",
//async: false,
dataType: "xml",
success: function(xml)
console.log("ayy");
);
);
When I try to reach my XML file located in my xml folder, my request keeps getting blocked by CORS policy (when I am trying to access a LOCAL file !). On the other hand, if I put all the files in the same directory (and change the links of course), it works.
Basically, CORS policy is preventing me from organising my local web application.
Is there a way to solve this ? CORS Policy shouldn't be blocking me for trying to read a local file, right ?
javascript jquery html xml cors
New contributor
Eox is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
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
-> home.html
-> js
-> jquery.js
-> XMLReader.js (made it myself)
-> XML
-> test.xml
XMLReader.js is made like this :
'use strict'
$(document).ready(function()
$.ajax(
type: "GET",
url: "../xml/test.xml",
//async: false,
dataType: "xml",
success: function(xml)
console.log("ayy");
);
);
When I try to reach my XML file located in my xml folder, my request keeps getting blocked by CORS policy (when I am trying to access a LOCAL file !). On the other hand, if I put all the files in the same directory (and change the links of course), it works.
Basically, CORS policy is preventing me from organising my local web application.
Is there a way to solve this ? CORS Policy shouldn't be blocking me for trying to read a local file, right ?
javascript jquery html xml cors
javascript jquery html xml cors
New contributor
Eox is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Eox is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 2 days ago
Eox
New contributor
Eox is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 2 days ago
EoxEox
44
44
New contributor
Eox is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Eox is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Eox is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
What’s the exact error message the browser is logging in the devtools console?
– sideshowbarker
2 days ago
@sideshowbarker "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///home/alexandre/Bureau/xml/testLayout.xml. (Reason: CORS request not http)."
– Eox
2 days ago
add a comment |
What’s the exact error message the browser is logging in the devtools console?
– sideshowbarker
2 days ago
@sideshowbarker "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///home/alexandre/Bureau/xml/testLayout.xml. (Reason: CORS request not http)."
– Eox
2 days ago
What’s the exact error message the browser is logging in the devtools console?
– sideshowbarker
2 days ago
What’s the exact error message the browser is logging in the devtools console?
– sideshowbarker
2 days ago
@sideshowbarker "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///home/alexandre/Bureau/xml/testLayout.xml. (Reason: CORS request not http)."
– Eox
2 days ago
@sideshowbarker "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///home/alexandre/Bureau/xml/testLayout.xml. (Reason: CORS request not http)."
– Eox
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
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
What could I use to create that local server easly without installing too much stuff ?
– Eox
2 days ago
npmjs.com/package/http-server
– Quentin
2 days ago
Ok actually nevermind : my company doesn't want me to have to resort to a server. It's a local app that is supposed to use the Firefox browser as an interpreter, so no need to use internet. Is there another solution perhaps ?
– Eox
2 days ago
No, there isn't. Only the two I listed already. (Well, that and replacing Firefox with something else, like a custom application).
– Quentin
2 days ago
That's too bad. Thanks for the clarifications though.
– Eox
2 days ago
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Eox is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55281250%2flocal-xml-blocked-by-cors-policy%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
What could I use to create that local server easly without installing too much stuff ?
– Eox
2 days ago
npmjs.com/package/http-server
– Quentin
2 days ago
Ok actually nevermind : my company doesn't want me to have to resort to a server. It's a local app that is supposed to use the Firefox browser as an interpreter, so no need to use internet. Is there another solution perhaps ?
– Eox
2 days ago
No, there isn't. Only the two I listed already. (Well, that and replacing Firefox with something else, like a custom application).
– Quentin
2 days ago
That's too bad. Thanks for the clarifications though.
– Eox
2 days ago
add a comment |
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
What could I use to create that local server easly without installing too much stuff ?
– Eox
2 days ago
npmjs.com/package/http-server
– Quentin
2 days ago
Ok actually nevermind : my company doesn't want me to have to resort to a server. It's a local app that is supposed to use the Firefox browser as an interpreter, so no need to use internet. Is there another solution perhaps ?
– Eox
2 days ago
No, there isn't. Only the two I listed already. (Well, that and replacing Firefox with something else, like a custom application).
– Quentin
2 days ago
That's too bad. Thanks for the clarifications though.
– Eox
2 days ago
add a comment |
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
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
answered 2 days ago
QuentinQuentin
655k728901054
655k728901054
What could I use to create that local server easly without installing too much stuff ?
– Eox
2 days ago
npmjs.com/package/http-server
– Quentin
2 days ago
Ok actually nevermind : my company doesn't want me to have to resort to a server. It's a local app that is supposed to use the Firefox browser as an interpreter, so no need to use internet. Is there another solution perhaps ?
– Eox
2 days ago
No, there isn't. Only the two I listed already. (Well, that and replacing Firefox with something else, like a custom application).
– Quentin
2 days ago
That's too bad. Thanks for the clarifications though.
– Eox
2 days ago
add a comment |
What could I use to create that local server easly without installing too much stuff ?
– Eox
2 days ago
npmjs.com/package/http-server
– Quentin
2 days ago
Ok actually nevermind : my company doesn't want me to have to resort to a server. It's a local app that is supposed to use the Firefox browser as an interpreter, so no need to use internet. Is there another solution perhaps ?
– Eox
2 days ago
No, there isn't. Only the two I listed already. (Well, that and replacing Firefox with something else, like a custom application).
– Quentin
2 days ago
That's too bad. Thanks for the clarifications though.
– Eox
2 days ago
What could I use to create that local server easly without installing too much stuff ?
– Eox
2 days ago
What could I use to create that local server easly without installing too much stuff ?
– Eox
2 days ago
npmjs.com/package/http-server
– Quentin
2 days ago
npmjs.com/package/http-server
– Quentin
2 days ago
Ok actually nevermind : my company doesn't want me to have to resort to a server. It's a local app that is supposed to use the Firefox browser as an interpreter, so no need to use internet. Is there another solution perhaps ?
– Eox
2 days ago
Ok actually nevermind : my company doesn't want me to have to resort to a server. It's a local app that is supposed to use the Firefox browser as an interpreter, so no need to use internet. Is there another solution perhaps ?
– Eox
2 days ago
No, there isn't. Only the two I listed already. (Well, that and replacing Firefox with something else, like a custom application).
– Quentin
2 days ago
No, there isn't. Only the two I listed already. (Well, that and replacing Firefox with something else, like a custom application).
– Quentin
2 days ago
That's too bad. Thanks for the clarifications though.
– Eox
2 days ago
That's too bad. Thanks for the clarifications though.
– Eox
2 days ago
add a comment |
Eox is a new contributor. Be nice, and check out our Code of Conduct.
Eox is a new contributor. Be nice, and check out our Code of Conduct.
Eox is a new contributor. Be nice, and check out our Code of Conduct.
Eox is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55281250%2flocal-xml-blocked-by-cors-policy%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What’s the exact error message the browser is logging in the devtools console?
– sideshowbarker
2 days ago
@sideshowbarker "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///home/alexandre/Bureau/xml/testLayout.xml. (Reason: CORS request not http)."
– Eox
2 days ago