Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cycle through tabs , Google Chrome extensions API

I'm working on a slideshow extension for Google Chrome. I've created the code that fetches the right URLs and opens them in one tab each. Now I'm looking for a function in the Chrome extension API that will allow me to switch tabs programmatically, but I can't find one? Is there one and if not, what are my options?

like image 703
C. E. Avatar asked Sep 16 '11 20:09

C. E.


People also ask

Is there a way to cycle through tabs in Chrome?

The keyboard shortcut Cmd + Shift + A (Mac) or Alt + Shift + A (Windows) is the easiest way to switch between tabs in Chrome. This shortcut pulls up a sidebar of your recent tabs.

How do I cycle my browser tabs?

Cycling tabsUse the keyboard shortcut Ctrl+Tab and Ctrl+Shift+Tab to move in the opposite direction, or. Enable Switch Tabs by Scrolling in Settings > Tabs > Tab Features > Tab Cycling to switch tabs by holding down the Alt key or right mouse button and scroll with the mouse wheel.

Can Chrome extensions close tabs?

Allows you to close other tabs with one click on the extension icon. Right-clicking on the same icon brings context menu with additional options ("Close tabs to the right" and "Close tabs to the left"). The extension also supports keyboard shortcuts. Go to chrome://extensions/shortcuts to set them.


1 Answers

Are you looking for the Tabs API? The update() method allows you to select a tab like this:

chrome.tabs.update(tabId, {selected: true});
like image 110
Digital Plane Avatar answered Dec 04 '22 17:12

Digital Plane