简体   繁体   English

Google Chrome扩展程序,新标签页焦点

[英]Google Chrome Extension, new tab focus

I've been working on an extension for Google Chrome, this is my first attempt. 我一直在为Google Chrome浏览器扩展程序,这是我的第一次尝试。 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. 例如,我正在实现一个输入字段或文本区域,并且当一个新选项卡打开时,我希望闪烁的光标/插入符号起源于所述文本区域,而不是Google多功能栏。

Any possibility using jquery or any google chrome extension api? 有可能使用jquery或任何Google chrome扩展api吗?

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): 我的解决方案是使用“虚拟html”文件作为新页面,并且该页面所做的所有操作都运行以下JavaScript代码(在与虚拟html文件链接的外部JS文件中):

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM