Error: uncaught exception: Permission denied to call method XMLHttpRequest.open

Written on January 1, 2008 – 1:55 am | by Hii Hiong Ching |

Thanks very much for the following articles as it solve my pain about ajax.

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

Below is an example that can be run locally (save it to your harddisk and open the page with Mozilla/Firefox). It will fetch some RSS XML data from wunderground.com and alert it.

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.

Still, it comes in handy, if you can read remote data from a local application. E.g. you’ve got a local XUL application that needs to get data from other servers – Dude! Sweet! :-)

If you’re doing some extension to the Mozilla/Firefox browser, you don’t need to care about permissions. Such an extension is installed into the core of the browser anyway, hence it has all privileges.

cross-domain-xmlhttprequest.html



  onclick="javascript:updateweather();"/>

Popularity: 78% [?]

  • No Related Post

Post a Comment

About Office-it.orG

This is a site to share my knowledge, discovery and experience related to my hobby and work. Most articles on this site are related to web design, web development, graphic design, short reviews, tips and tricks. I sometimes write some about Microsoft Office Application too.

Want to subscribe?

RSS Subscribe in a reader Or, subscribe via email:
Enter your email address:  
Find entries :