Getting "Access to Restricted URI denied" error, but not using Cross-Domain??
I'm creating an web mapping application with AJAX functionality. I'm also a little new to the use of AJAX so this is my first time using this.
So I retrieve an XML file through my own web server. But the thing is, I'm getting this error message (Error code 1012) on my Error Console on Firefox, even though I'm not using any cross-domain referencing. The application works perfectly fine on IE though.
I'm not sure if it has to do with the fact that I'm using a port number within the URL for the GET call (see code below).
Here is a snippet of my javaScript file:
Code:
// initialize the XMLHttpRequest object
if (window.XMLHttpRequest) {
// If IE7, Mozilla, Safari, and so on: Use native object.
xhr = new XMLHttpRequest();
} else {
if (window.ActiveXObject) {
// ...otherwise, use the ActiveX control for IE5.x and IE6.
xhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
} else {
alert('XMLHttpRequest not supported. Your browser does not support XMLHttpRequest');
}
}
// handle xhr callback
xhr.onreadystatechange = function(){
if(xhr.readyState == 4) { // if done loading url
if(xhr.status == 200) {// if url is ok
myFunctionToHandleResponse(xhr.responseXML);
}else {
alert('An error occurred. XMLHttpRequest status code: ' + xhr.status);
}
}
}
// example URL format I'm using
url = "http://webfeed.mywebserver.ca:9090/?SERVICE=EXT"
url+= "&REQUEST=GetWarningInfo&INFO_FORMAT=text/xml
url+= "&LON=58.446798&LAT=60.654948&TIME=2009-05-11T17:00:00Z"
url+= "&MOREQUERY=blahblah"
// AJAX call
xhr.open('GET',url, true);
xhr.send(null);
Re: Getting "Access to Restricted URI denied" error, but not using Cross-Domain??
Even though you may be executing this on the same domain, because you supplied the full http://... the browser assumes it is cross-domain. You need to use relative paths when working with AJAX.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Re: Getting "Access to Restricted URI denied" error, but not using Cross-Domain??
So what would be the relative path format? I tried doing:
"../:9090/?SERVICE=EXT&QUERY=blahblah"
But I don't think it's right. How would you specify a relative path and having to specify the port number into it?
Bookmarks