Okay, if you ever need to refocus on an iframe window...
var iframe = document.getElementById('myframe');
var content = (iframe.contentWindow || iframe.contentDocument);
content.focus();
If you want to support Internet Explorer or Edge browsers, make sure that the iframe content is in the same domain name as the parent window. Please note that the above code functions correctly on all other browsers when the src of the iframe is from a different domain name.