Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

chrome api - move tab out of window

Is it possible to take an existing tab, move it out of its window and create a new window directly?

Using the window api I can create a new window with an empty tab, and with the tab api I can move my tab of interest there and remove the empty tab. That's quite a lot of steps and the visual is very different from the manual action of dragging a tab out of its window.

Is there not a way to create a window directly from an existing tab with the api?

like image 999
Guig Avatar asked Oct 18 '25 00:10

Guig


2 Answers

There is no possibility to do it in one way, just as you said. First, you need to create a new empty window and then you can use chrome.tabs.move method for it.

It has one limitation: tabs can only be moved to and from normal (window.type === "normal") windows.

Example:

chrome.tabs.move(tabId, { index : 1, windowId: 2 });
like image 198
Sergii Rudenko Avatar answered Oct 20 '25 15:10

Sergii Rudenko


Maybe this API appeared after your question, but it's now possible to move a tab to its own new window with the following command:

chrome.windows.create({ tabId })

tabId: "The ID of the tab to add to the new window."

like image 33
richardkmiller Avatar answered Oct 20 '25 14:10

richardkmiller



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!