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?
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 });
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."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With