The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Chester (3) [Avatar] Offline
Hello everybody,
I have a problem that I have not been able to find an answer to even after hours of Google searching.

I have a page (I'll call this 'child page', for reasons that will become clear presently) that contains a button that, when pressed, makes an asynchronous request to the server. The request goes through, and a response comes back. It works without a glitch. It's a very simple page I set up for test purposes only.

HOWEVER, I also have another page (which I'll call 'parent page') which also has a button, which, when pressed, triggers a call to '', which takes, as the url argument, "child page" (described above). When I click the button on "parent page", "child page opens as expected, but the button therein no longer works. Instead, I get this error:

[Exception... "'Permission denied to call method' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no]

All information that I have found online addressing this error message assumes that the script that is called by is on another domain from that which hosts the page that calls The advice commonly given is based on this assumption, after an explanation of why this is the case from a security point-of-view. However, in my case, EVERYTHING is on the same domain: parent-page, child-page, and the script called (opened) by

I'm using an Apple Macintosh computer. The problem does NOT occur on Safari. It occurs on Firefox. (I don't know yet whether it occurs on Microsoft's browser.) It occurs both on my local production server, as well as when I upload the files to my website. (However, in both cases, everything is confined to their respective domains.)

One strange (and seemingly contrary, based on the online discussions of this error) phenomenon I've noted. Ordinarily, "parent-page" opens "child-page" via via a RELATIVE path url argument. It opens, like I said, with no problem, but, as described above, throws an error message when its AJAX-triggering button is pressed.

However, when instead, on my local development server (as a test), I provide a full absolute url argument to, which describes the localhost domain DIFFERENTLY that that url which was used to initially open "parent-page", (for example, I'll use "" to open parent-page, but I'll hardcode an absolute url path containing "localhost" as an argument to the "child-page"-opening script in "parent-page), the error clears up!!??

This seems very contrary to all the advice I've seen addressing this error message, i.e., that the domain must be the same. In fact, of course the domain has always been the same in both instances, but the error is not replicated when the domain is described in a DIFFERENT manner, but, strangely, DOES appear when the domain is consistently described exactly the same.

Can anybody shed some light on what could possibly be causing this problem?

benoit.sagols (1) [Avatar] Offline
Re: permission denied
Hello, I'm facing wiht the EXACT same problem !! I search everywhere on the web but found nothing ! Just your POST that makes me very happy ! But anybody respond to you...

Anyway did you find a solution to this problem (calling XmlHTTPRequest from a popup...)?

Thanks a lot.
Pascarello (208) [Avatar] Offline
Re: permission denied

Message was edited by:
Pascarello (208) [Avatar] Offline
Re: permission denied
Are you using sub-domains? What does the statement look like? Does one use www and the other doesn't?

Does you request have a leading "/" ?


Message was edited by:

Message was edited by:
igorgl (2) [Avatar] Offline
Re: permission denied
I am faced with the same exact problem on Firefox side.

Was any resolution found? Chapter 7 of your great book does talk about this issue, however when i downloaded the source code for net.js the logic of handling Firefox security was not there.

Please help.

davecrane (149) [Avatar] Offline
Re: permission denied
Hi Igor,

Could you post a snippet of code showing how the call is being made? Feel free to change the URL if it's confidential, but I need to see how the front of the URL looks i.e. whether it's relative or absolute.

I won't pretend to understand all the inner workings of the security policies on the different browsers. I tend to be fairly conservative in practice, and always use relative URLs, so I don't have to think too much about whether the domain is the same or not. Some of the behaviour described in this thread sounds very odd, I'd be interested to get to the bottom of it!


igorgl (2) [Avatar] Offline
Re: permission denied
Hi Dave,

I was able to resolve the issue and ended up learning a great deal of stuff. I need to restate what my problem was first. My project was to enable "Type-Ahead Suggest" functionality for a bunch of input fields. I started by incorporating JavaScripts described in Chapter 10. Had to make a some changes to satisfy our requirements. All My work was done with IE in mind.
My next step was to make sure all that works in FireFox. Because of the fact that my form has practically no static HTML , almost all elements are build dynamically, first time using FF produced no results (programming for IE does tend to steer you in a wrong direction at times).
My strategy then was to move all my pages and scripts to my local drive and experiment with them there. This is how I ended up with the "security" problem that I posted earlier. Once I finished my changes and moved my stuff back to the server, the problem was gone!

In my "Type-Ahead Suggest" endeavor I had to solve a ton of problems on both sides IE and FF. One of the biggest ones was that "Type-Ahead Suggest" little window in IE would cover most of the input fields but not the Drop Downs. If you are interested in my solution I will be more than happy to share it.

Here is the URL to the test server to the first page of this app - fill in all of the required fields to get to the second page where the "Type-Ahead Suggest" functionality is (look at the "Origin" and "Destination" fields). Since it is our test server and we are not done developing it it might be down once in a while.

I am also willing to share any little tricks that I had to use to make sure my JavaSripts function in both IE and FF.


francois (1) [Avatar] Offline
Re: permission denied
Hi Igor,

I'm trying to get an XMLHttpRequest to a gSOAP server that is used as Web Service using only client side capability. No Server side language support.

I'm still stuck with Access Denied error messages, even after trying all tweek I could find on Firefox to force it to do the request.

Any idea about how I get this working?

Thanks in advance
gargprabhat (1) [Avatar] Offline
Re: permission denied

I am facing the same issue. I am able to login with below code on local machine.but unable to login on client Machine from server. Facing the below
error.( error no -214682821smilie

var xmlHttp;
xmlHttp = new XMLHttpRequest();

else if(window.ActiveXObject)
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
//xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
//var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

var xmlHttpGo = xmlHttp;
var WebServicePath = "http://localhost/PerkWebService/WebServiceLeave/WebServiceLeave.asmx/" ;
var str = WebServicePath + serviceName;"POST", str, false);
xmlHttpGo.send('xmlreceive=' + objXML.xml);
var xmlString1 = xmlHttpGo.responseXML.text;
return xmlString1;
return (e.Message + "--> XmlhttpCall"smilie;
please send me the resolution.

thanks in advance