Error: uncaught exception: Permission denied to call method XMLHttpRequest.open
If you want to do cross-domain scripting with XMLHttpRequest, e.g. fetching data from a remote location but you’re on a local page or local XUL application (file:///), you need to tell Mozilla/Firefox about that, otherwise you get the infamous error:
Error: uncaught exception: Permission denied to call method XMLHttpRequest.open
Always remember: XMLHttpRequest needs UniversalBrowserRead!
If the page with the XMLHttpRequest is on a http:// URI (on a webserver), it is not possible to fetch data from another domain!!! This is a security measure of Mozilla/Firefox.
cross-domain-xmlhttprequest.html
<script type="text/javascript" language="javascript">
// Error: uncaught exception: Permission denied to call method XMLHttpRequest.open
var http_request = false;
function makeRequest(url, parameters) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
} catch (e) {
alert("Permission UniversalBrowserRead denied.");
}
http_request = false;
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}
http_request.onreadystatechange = alertContents;
http_request.open('GET', url + parameters, true);
http_request.send(null);
}
function alertContents() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
var string = http_request.responseText;
alert(string);
} else {
alert('There was a problem with the request.');
}
}
}
function updateweather() {
makeRequest('http://www.wunderground.com/auto/rss_full/global/stations/16239.xml', '');
}
</script>
<input type="button" name="button" value="GET XML"
onclick="javascript:updateweather();">
Source: http://www.captain.at/howto-ajax-permission-denied-xmlhttprequest.php



I think it will work with only NETSCAPE ENGINE based browser, but not with Internet explorer
Anjin Pradhan
May 29, 2009 at 9:49 pm
This does not seem to work in Firefox 3.0. I’ve also tried editing my “prefs.js” file to allow XMLHttpRequests. Anyone have any luck getting passed this in Firefox 3+? Thanks, MartyMayhem
Marty McGee
July 21, 2009 at 10:47 am