dcsimg
UniversalBrowserRead permissions in AJAX
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sandeep_Chandan
Posted On:   Tuesday, June 26, 2007 07:41 AM

Hello Does Any One Know This I tried to create XMLHttpRequest() using AJAX. But my problem is that my browser(ie Firefox) gives me the error stating "Permissions for UniverSalBrowser Read Denied " after searching a lot on the net i was able to find that 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. can any one please guide me how it is actually done My Code for creating the reuest is below: function AJAXInteraction(url, callback) { var req = init(); req.onreadystatechange = proce   More>>

Hello Does Any One Know This



I tried to create XMLHttpRequest() using AJAX.
But my problem is that my browser(ie Firefox) gives me the error stating

"Permissions for UniverSalBrowser Read Denied "


after searching a lot on the net i was able to find that
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.



can any one please guide me how it is actually done



My Code for creating the reuest is below:





function AJAXInteraction(url, callback) {

var req = init();

req.onreadystatechange = processRequest;

function init() {

if (window.XMLHttpRequest) {

try {

netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");

} catch (e) {

alert("Permission UniversalBrowserRead denied.");

return false;

}

return new XMLHttpRequest();

} else if (window.ActiveXObject) {

try{

return new ActiveXObject('Msxml2.XMLHTTP');

}catch (e){

try{

return new ActiveXObject('Microsoft.XMLHTTP');

}

catch (e){

alert('Unable To Create ActiveX Object');

return false;

}

}

}

}


function processRequest () {

if (req.readyState == 4) {

if (req.status == 200) {

if (callback) callback(req);

}

}

}


this.doGet = function() {

try{

req.open("GET", url, true);

req.send(null);

}

catch (err){

alert("Error In ajaxRequest.js.doGet()"+err.description);

return false;

}

}


this.doPost = function(body) {

req.open("POST", url, true);

req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

req.send(body);

}

}



One more thing i want my code to run without accesing the flag "signed.applets.codebase_principal_support" in firefox

   <<Less

Re: UniversalBrowserRead permissions in AJAX

Posted By:   Robert_Lybarger  
Posted On:   Tuesday, June 26, 2007 08:52 AM

I've never seen the code written that way, that is:

if (window.XMLHttpRequest) {
try {
netscape.security.PrivilegeManager.enablePrivilege(
"UniversalBrowserRead");
}
catch (e) {
alert("Permission UniversalBrowserRead denied.");
return false;
}
return new XMLHttpRequest();
}
else if (...) { ... }

Now, it could be that I'm a long way from an expert on ajax, but mozilla (firefox, etc.) browsers just usually need this:



if (window.XMLHttpRequest) {
return new XMLHttpRequest();
}
else if (...) { ... }

Now I'm sure you or someone will explain what the 'UniversalBrowserRead' thing even is, and why you think you need it.

About | Sitemap | Contact