MikeReynolds
MikeReynolds

Reputation: 325

Chrome tab focus

I know how to move focus between tabs but this is a different question. If two "instances" of Chrome are open, I need to direct the focus and all subsequent actions to the originally opened instance. Allow me to clarify (sort of). Our call center application loads Chrome and its home page upon log in. The agents have two monitors and often have a web site open on Monitor 2 in addition to our home page on Monitor 1. My extension checks the open tabs for one with a specific title and if found takes some action. My issue: If the agent is on the second monitor when the call hits, the new url pops on screen 2. I need it to pop on screen 1 and leave screen 2 untouched. Any thoughts on how I can move the focus from screen 2 back to screen 1 before my extension does anything else?

Upvotes: 1

Views: 4640

Answers (1)

Chirag Bhatia - chirag64
Chirag Bhatia - chirag64

Reputation: 4516

Your extension checks for open tabs for a tab with a specific title, and takes some action when its found. You can get the ID of that tab based on the title condition and can use the chrome.tabs.update() method with the active property set to true.

You can find further details about this on Chrome extension's documentation.

Upvotes: 2

Related Questions