views:

399

answers:

3

When I focus the iframe and try to push the esc key to close the window, nothing happens. I assume that it is because the focused iframe is not subscribed to this event. Does anyone have any ideas how I could attach this event to the iframe without having to manually edit each one of the pages that are contained in a thickbox?

A: 

Are you running Flash in the iframe? It could be stealing your keyboard focus.

orip
nope, and I can recreate the issue in firefox, chrome, ie.
Dave
A: 

This solution works in internet explorer, which happens to be the only browser my client base is using, however I would prefer a solution that at least works in firefox.

$("#TB_iframeContent").ready(function(){
    setTimeout(function(){
        $('#TB_iframeContent').contents().find('body').keyup(function(e){
            if(e.keyCode == 27){
                tb_remove();
            }
        });
    }, 50);
  });

I add this at line 245 in the original thickbox source.

Dave
A: 

It does not work for security reasons. None of the events that happen inside the iframe are allowed to bubble out to the containing document.

Marius