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













-2















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 ?










share|improve this question









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















-2















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 ?










share|improve this question









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













-2












-2








-2


1






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 ?










share|improve this question









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






share|improve this question









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.











share|improve this question









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.









share|improve this question




share|improve this question








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

















  • 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












1 Answer
1






active

oldest

votes


















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





share|improve this answer























  • 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










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.









draft saved

draft discarded


















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









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





share|improve this answer























  • 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















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





share|improve this answer























  • 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













1












1








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





share|improve this answer













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






share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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












Eox is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴