I believe this is fixed in SVN/jQuery nightlies. However, there is still an issue with popups... but should work just fine for iframes. Try the nightly and see if that fixes the issue you are having: http://code.jquery.com/jquery-nightly.js
-- Brandon Aaron On Tue, Sep 1, 2009 at 8:22 AM, Henrik T<htenge...@gmail.com> wrote: > > Hi! > Tried this question in jQuery(English) without any response so I am > hoping for more luck here. > > I am using jQuery 1.3.2 and for some reason I am trying to add event > listeners to windows/documents in iframes (yeah I know...) from the > parent window and I have run into some problems... > > Does anyone know why it's possible to bind a listener to the click > event of the document in an iframe but not bind a listener to the > unload event of the window object (contentWindow) in the same iframe? > At least the unload isn't triggered when the iframe.src is changed. > > Since it is possible to bind to the click event of the document in the > iframe an unload handler will automatically be registered in IE (to > prevent memory leaks) but this unload handler will not be triggered > when the iframe.src is changed, which in turn will cause an annoying > javascript error (permission denied) when you first alter the > iframe.src and then reload the top window. I have tested with > "beforeunload" with the same result. > > Using win.attachEvent/addEventListener works fine... > > $(document).ready(function() { > $("#clickable").click(function() { > $("#frame1").attr("src", "frame2.html"); > }); > > addEvents(window); > > }); > > function addEvents(win) { > if (win.contentWindow) { > win = win.contentWindow; > } > > $(win.document).bind("click", function() {alert("click");}); > $(win).bind("unload", function() {alert("unload");}); > > var frames = win.document.getElementsByTagName("iframe"); > for (var i=0; i < frames.length; i++) { > addEvents(frames[i]); > } > > } > > <div id="clickable">Click me</div> > <iframe id="frame1" src="frame1.html"></iframe> > > /Thank you for showing interest > Henrik > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---