Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
118
rated 0 times [  124] [ 6]  / answers: 1 / hits: 50732  / 13 Years ago, mon, july 11, 2011, 12:00:00

Access to restricted URI denied" code: "1012 [Break On This Error]


xhttp.send(null);



function getXML(xml_file) {

if (window.XMLHttpRequest) {

var xhttp = new XMLHttpRequest(); // Cretes a instantce of XMLHttpRequest object
}
else {

var xhttp = new ActiveXObject("Microsoft.XMLHTTP"); // for IE 5/6
}

xhttp.open("GET",xml_file,false);
xhttp.send(null);

var xmlDoc = xhttp.responseXML;

return (xmlDoc);
}

I'm trying to get data from a XML file using JavaScript. Im using Firebug to test and debug on Firefox.


The above error is what I'm getting. It works in other places i used the same before, why is acting weird here?


Can someone help me why it's occuring?


Update:


http://jquery-howto.blogspot.com/2008/12/access-to-restricted-uri-denied-code.html


I found this link explaining the cause of the problem. But I didn't get what the solution given means can someone elaborate?


More From » html

 Answers
6

Another possible cause of this is when you are working with a .html file directly on the file system. For example, if you're accessing it using this url in your browser: C:/Users/Someguy/Desktop/MyProject/index.html



If that then has to make an ajax request, the ajax request will fail because ajax requests to the filesystem are restricted. To fix this, setup a webserver that points localhost to C:/Users/Someguy/Desktop/MyProject and access it from http://localhost/index.html


[#91245] Saturday, July 9, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
irvingcarloe

Total Points: 677
Total Questions: 109
Total Answers: 96

Location: Svalbard and Jan Mayen
Member since Sun, Sep 25, 2022
2 Years ago
;