1

I need to use some scripts after window.onblur event. But on my app i have Google Maps, which one is injected into iframe. Evervy click on iframe firing window.onblur(). How to prevent this?

snuuve
  • 315
  • 3
  • 14

1 Answers1

1

You can prevent the default window.blur event if the original target of the event is the iframe.

$(window).blur(function(event){
    if($(event.target).attr('id')== "myiframe"){
        event.preventDefault();
    }
});
Pang
  • 9,564
  • 146
  • 81
  • 122