iframe stealing focus

Hi,

Is there a clean way to have focus retained by a parent page (.asp) when there exists iframed content that is uncontrolled (and trying to steal focus)



Answer this question

iframe stealing focus

  • davidlee9023

    Have you tried putting an onfocus event in the IFRAME element

    Example:

    <IFRAME src="http://www.yahoo.com" onfocus="window.focus()"></IFRAME>

    if that doesnt work, you can add an event handler to the parent window to retain focus.

    Example:

    <SCRIPT language="Javascript">
    window.onblur = function() { window.focus(); }

    </SCRIPT>


    If you find that the IFRAME still retains focus, you may want to try switching out the window object in these examples with "document.body"


  • iframe stealing focus