Sreehari
Sreehari

Reputation: 515

How to select a browser tab from another tab?

I want to select a browser tab from another tab. For example one of my web app is opened in a browser and I opened a link in another tab. Now I want to select my first tab using a shortcut key like "CTRL+M" or something like that.

How can I do this?

Upvotes: 0

Views: 1638

Answers (2)

Eschon
Eschon

Reputation: 538

As far as I know this only works if one of the tabs is a popup of another tab. Then you can use

window.opener.focus();

To focus the tab that opened the pop up and

popupName.focus(); 

To focuse the pop up

Upvotes: 1

nirazul
nirazul

Reputation: 3955

You are not able to select anything outside your HTML-structure programmatically. The only option you have, is to close the current tab so it may jump back to the last tab:

window.close();

Even this approach is based on some assumptions and unreliable. Don't go that way ;)

Upvotes: 2

Related Questions