Accessing Sites on Different Domains With AJAX

After reading posts from Dare Obasanjo aka Carnage4Life and Links on the Semantic Web I noticed that some people are having problems when making AJAX calls from one serer to another.

I believe is the problem that most would come across:
Error: uncaught exception: Permission denied to call method XMLHttpRequest.open in Mozilla Firefox.

And here is the fix: Just insert this block of code right before you declare the new XMLHttpRequest object:


try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
} catch (e)
{
alert("Permission UniversalBrowserRead denied.");
}

I sure hope this helps some people.
[tags]AJAX, web2.0, web 2.0[/tags]

Comments

  1. I tried this approach with jquery. Somehow it didn’t work.

    Thanks anyways.

    Cheers 🙂