Search code examples
javascriptgoogle-chromegoogle-chrome-extensiontabsjquery-tabs

Google Chrome Extension, new tab focus


I've been working on an extension for Google Chrome, this is my first attempt. So far I've been able to run my extension in a new tab, but I wanted to know if there was any possibility to remove the focus from the omnibar/addressbar to some content in the tabbed window.

For Example, I'm implementing an input field or text area, and when a new tab opens, I want the blinking cursor/caret to originate in the said text area, and not the google omnibar.

Any possibility using jquery or any google chrome extension api?


Solution

  • I had the same problem. My solution was to use a "dummy html" file as the new page, and everything this page did was running the following JavaScript code (in an external JS file linked to from the dummy html file):

    window.open("the-real-new-tab-page.html")
    window.close()