My issue here is that I am loading an iframe on top of my current window. When I hide this iFrame, I need the focus to be given back to the original window that opened the iFrame so that it can detect keyboard strokes.
My idea is to grab the element that currently has focus before opening the iFrame, and then give it back the focus when the iframe is closed.
I have tried doing window.focus() and top.window.focus() but it does not seem to work.