tags:

views:

20

answers:

1

I am launching a popup window with window.open(...) and I pass an elementId to the new popup window.

Then during startup of the popup window I find the element in the opener window that matches the elementId passed to the popup. Then the popup subscribes to events on that element using jQuery.bind(...). Then from inside the opener window I fire these events using jQuery.trigger(...), I also tried triggerHandlers.

The problem is that my popup's eventHandlers never get called. I can subscribe to the events from within inside the opener window no problem. However, when I try from the popup, it doesn't work.

Does anyone have any ideas on how to fix this? Is this some kind of security description?

Thanks a lot for reading!

A: 
Pointy
cool, have you come across this in documentation somewhere?
internet man
Well it's just my experience, and it's pretty easy to test with a really simple experiment page (or pages I guess). I suppose I can't say I'm 100% positive that it's always true in every browser; I'll write a quick test and update my answer if I'm wrong of course!
Pointy
Whoa! Answer updated!!
Pointy
hmmm, not sure why my case isn't working, but thanks a lot!
internet man
thanks again.var openingControl = window.opener.document.getElementById(openingControlId); works but $("#" + openingControlId, window.opener.document); does not.
internet man
or actually both those lines find the element, but events don't work on the second one.
internet man
Are you *sure* that, from the popup page, that `$('#' + something)` really finds the element? I don't see how that's possible, because on the popup page jQuery will just be looking in that DOM; it does not traverse `window.opener` and also look there. At least, I don't think it does; I can write another test.
Pointy