PDA

View Full Version : Problem with API, JSON with FIREFOX


virtualprofe01
06-30-2009, 07:27 AM
I use JSON to request de params from IsMeetingRoomOccupied
but this not working in Firefox because Firefox tells me that:

Error: uncaught exception: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" ...
http://webmeeting.dimdim.com/portal/IsMeetingRoomOccupied.action?...

How can I pick up the parameters?

function comprobarDimDim()
{
var http_request = new XMLHttpRequest();
var url = "http://webmeeting.dimdim.com/portal/IsMeetingRoomOccupied.action?roomName=XXXX"; // Esta URL debería devolver datos JSON

// Descarga los datos JSON del servidor.
http_request.onreadystatechange = handle_json;
http_request.open("GET", url, true);
http_request.send(null);

function handle_json() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
var json_data = http_request.responseText;
var the_object = eval("(" + json_data + ")");

if ((json_data.indexOf('true')!=-1) && (json_data.indexOf('true')!=-1)) {
location.href= "<%=urldimdim%>";
}
else
{
alert("En estos momentos el sistema de Videoconferencia está ocupado. Consulte con el administrador del sistema");
}

} else {
alert("Ha habido un problema con la URL.");
}
http_request = null;
}
}
}

veddi01.dimdim
06-30-2009, 10:44 PM
This is an error which indicates that your javascript is trying to access a resource from a different domain,

Some thing like a page from xxx.com is trying to access a resource from yyy.com which is not allowed in java script. This is agains the security model.

This is more commonly known as cross domain scripting or cross domain ajax. You can search for more information on it on web. There are some suggested workarounds for this.

Please have a look at http://developer.yahoo.com/javascript/howto-proxy.html which explains a solution.