0

I am trying to read a .xml file that is a feed using JavaScript/JQuery in my PC to show data on my browser. You can view my feed.xml file online that I saved from GoogleBlogXMLFeed. When I tried to read it via following codes in my index.html file that is in same folder where feed.xml file is...

<script src="http://code.jquery.com/jquery-2.2.0.min.js"></script>
<script>
    $.ajax({
        url: "feed.xml",
        success: function(xml){ 
            var xmlDoc = $.parseXML(xml),
            $xml = $(xmlDoc),
            title = $xml.find("title").text();
            alert(title);
        }
    });
</script>

But on opening my file in Chrome, I am getting the below error.

XMLHttpRequest cannot load file:///D:/feed.xml Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

I am not using any SERVER/HOST like Wamp,IIS,Xamp etc. So is there any way to remove this error and read the file data as normal XML...???

Muhammad Hassan
  • 1,224
  • 5
  • 31
  • 51

1 Answers1

0

No. Chrome does not allow cross-origin requests for files loaded from the file system. See this question that has been asked before.

Problems with jQuery getJSON using local files in Chrome

Community
  • 1
  • 1
Vale H
  • 491
  • 5
  • 16