If you control the contents of the parent and the contents of the iframe, you can use postMessage to pass the parent onfocus event to the iframe.
Here is an example:
<iframe> content:
<!doctype html> <html> <head> <script> </script> </head> <body> <h1>Child</h1> </body> </html>;
Parent content:
window.addEventListener('focus', function(event){ iframe.postMessage('focus-event', '*'); }, false);
This will make sure that every time the parent window receives a focus event, it sends this message to the iframe.
Here is an example of JSBin .
source share