title: How to get focus back for parent window from an iframe programmatically in Javascript
body: <p>Some websites have <code>focus</code> set on an element on window load. If I iframe that website, It seems not able to set focus on parent window, programmatically. This only happens to <code>IE</code> (9) and <code>Firefox</code> (19), Opera/Safari/Chrome are fine.</p>
  
  <pre class="lang-javascript prettyprint-override"><code>&lt;script&gt;
  window.onload = function() {
      setTimeout(function() {
          // this does not focus #foo
          document.getElementById("foo").focus();
      // or more seconds that enough to see the iframe focus
      }, 3000);
  };
  &lt;/script&gt;
  &lt;input id="foo" type="text" value="foo" /&gt;&lt;br /&gt;
  &lt;iframe width="800" height="500" src="http://www.bing.com" /&gt;
  </code></pre>
  
  <p>Does anyone know a workaround for this problem?</p>