2

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?

kkaul
  • 147
  • 1
  • 2
  • 13
  • Do you mean something like `.textarea { outline: none; }`? Or is it something else. – lindsay Jun 05 '14 at 00:10
  • Did you try the `.focus()` method on the textarea element? – devnull69 Jun 05 '14 at 06:52
  • If you mean that you're overriding the new tab page, it's a duplicate of http://stackoverflow.com/questions/17598778/how-to-steal-focus-from-the-omnibox-in-a-chrome-extension-on-the-new-tab-page Please clarify. – Xan Jun 05 '14 at 17:06
  • @lindsay sorry but thats not what I meant. – kkaul Jun 05 '14 at 23:34
  • @devnull69 the omnibox focus overrides the tab focus – kkaul Jun 05 '14 at 23:35
  • @Xan Thanks! Thats exactly what I was looking for! Couldn't find it because I couldn't phrase it right! – kkaul Jun 05 '14 at 23:36

1 Answers1

2

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()
Peppe L-G
  • 7,351
  • 2
  • 25
  • 50