Thursday, March 5, 2009

Cross-site request

It is handy to test javascript snippets without uploading them on a production server. But it is hard to test AJAX request like that. The reason for it is that firefox doesn't allow a cross-site request for a sake of user's security.
uncaught exception: Access to restricted URI denied (NS_ERROR_DOM_BAD_URI)
But if you know what you are doing you can temporarley switch this behavior off. Open about:config page and set signed.applets.codebase_principal_support to true. Also your script must have the following line executed before any cross-site request:
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
And don't forget to set signed.applets.codebase_principal_support to false value back and remove the line above from script when you have done with testing!!

3 comments: