Error: uncaught exception: Permission denied to call method

Posted: February 7, 2007 in next to nothing

Error: uncaught exception: Permission denied to call method is basically a security feature. you get this error when a cross-domain call is made from your AJAX script, e.g. fetching another page or data from a remote location or from another domain other than the one where your script is sitting on.

this is supposedly an infamous error on Mozilla Firefox browsers only. but i think the same error (the logic anyway) would apply to Internet Explorer as well. you just don’t see it. the XMLHttpRequest object was introduced by Microsoft after all.

now i’ve been making a web application lately and unfortunately encountered this error. i first tested the app on plain http. works fine out of the box. but then this has to sit on secure http (https). oops! pages being called through the script ain’t showing. a quick check on the apache logs didn’t give me much info. after scouring through the script (both PHP and AJAX) for odds and bits, i didn’t find anything that was out of place. but then thank God for the Firefox Error Console! this is where i first saw the error.

the funny thing is that i’m not doing any cross-domain calls with this script. it’s only supposed to load pages from the same place/domain where it is currently residing. (or is it considered a cross-domain call already when you specify a full URL path for the script to load?)

i needed a quick fix on this error. so to make a long story short, a quick post on one Linux forums + Google pointed me to an informative site about this error. in not time i was able to make it work on secure http. the added help gave me hints. plus a quick rewrite of the original AJAX script i was using. but the fix i discovered myself, and i’m sure a lot of pips have already realized this before me as well (but i’m blogging it anyway).

when telling the script which page/file to load i was using a full URL path, like this:

url = “http://”+path+”/dir/”+pagename+”.php”

where +path+ is not a directory path but the server IP or name.

so instead of passing the full URL path to the AJAX script, i instead found out that just giving it the pagename or the script’s filename won’t throw an error.

so now i have this:

url = pagename+”.php”


also add this at the top of the script or before you have it do anything, it might help:

try {“UniversalBrowserRead”);
} catch (e) {
   //something to do here

  1. name says:

    Ever notice how fast Windows runs? Neither did I.

  2. <a href="">easy customer comments on herbal phentermine hoodia</a> says:

    actually, that’s brilliant. Thank you. I’m going to pass that on to a couple of people.

  3. <a href="">expert pharmacy</a> says:

    Nice Article.

  4. <a href="">amalfi coast and tuscany tour</a> says:

    actually, that’s brilliant. Thank you. I’m going to pass that on to a couple of people.

  5. yamzzz says:

    you are using java servlets?

    i read another fix somewhere but have been very busy the past few months. would have been good to post it here or at least just a link to that article.

  6. aladdin says:

    This error has been giving me fits, to. Unfortunately, with servlets, this fix doesn’t seem to work.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s