title: Chrome Extension: blank new tab + address bar focus
body: <p>I'm using  <a href="https://chrome.google.com/webstore/detail/empty-new-tab-page/dpjamkmjmigaoobjbekmfgabipmfilij" rel="nofollow">this extension</a> to get a blank page each time I open a new tab, unfortunately the address bar is not focused after the new tab is open.</p>
  
  <p>I changed the new page contents to dispatch the keystroke 9 to simulate the tab key. which causes the browser to focus on the address bar but it didn't work.</p>
  
  <pre><code>&lt;title&gt;&amp;#65279;&lt;/title&gt;
  &lt;script&gt;
  function init() {
      var k = 9;
  
      var oEvent = document.createEvent('KeyboardEvent');
  
      // Chromium Hack
      Object.defineProperty(oEvent, 'keyCode', {
                  get : function() {
                      return this.keyCodeVal;
                  }
      });     
      Object.defineProperty(oEvent, 'which', {
                  get : function() {
                      return this.keyCodeVal;
                  }
      });     
  
      if (oEvent.initKeyboardEvent) {
          oEvent.initKeyboardEvent("keydown", true, true, document.defaultView, false, false, false, false, k, k);
      } else {
          oEvent.initKeyEvent("keydown", true, true, document.defaultView, false, false, false, false, k, 0);
      }
  
      oEvent.keyCodeVal = k;
  
      if (oEvent.keyCode !== k) {
          alert("keyCode mismatch " + oEvent.keyCode + "(" + oEvent.which + ")");
      }
  
      document.dispatchEvent(oEvent);
  }
  &lt;/script&gt;
  &lt;body onload="init()"&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Is there some alternative to do that?</p>