Link to home
Start Free TrialLog in
Avatar of pamela rizk
pamela rizkFlag for Lebanon

asked on

leaving iframe event

is there any way to catch event when leaving  iframe ?
Avatar of Steven Kribbe
Steven Kribbe
Flag of Netherlands image

You can detect the loss of the focus of an iframe with this small piece of jQuerycode:

$(document).focusout( function(){
       setTimeout(function() {
       // used setTimeout to make sure the event is passing the event loop and call your logic as well
       if (document.activeElement instanceof HTMLIFrameElement) {
             // do stuff
        }
    },0);
});
ASKER CERTIFIED SOLUTION
Avatar of pamela rizk
pamela rizk
Flag of Lebanon image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pamela rizk

ASKER

this solution worked!