简体   繁体   English

如何在浏览器扩展中将选项卡移动到新的 window

[英]How to move tab to a new window in a browser extension

The following is not working all the time, just sometimes:以下内容并非一直有效,只是有时:

let win = await browser.windows.create()
await browser.tabs.move(tab.id, {index: 0, windowId: win.id})

I'm not sure if it's a problem with how I'm using the api.我不确定我使用 api 的方式是否有问题。

I checked some github repo and found they do this:我检查了一些 github 回购协议,发现他们这样做:

browser.tabs.create({active: true, url: tab.url})

That actually works.这确实有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 JavaScript 中实现“将选项卡移动到新窗口” - How to implement "move tab to new window" in JavaScript 如何将浏览器窗口移至spry手风琴选项卡的顶部? - How to move browser window to the top of an spry accordion tab? 如何在浏览器扩展中更改另一个 window 上的活动选项卡? - How to change the active a tab on another window in a browser extension? 新浏览器选项卡或窗口中的HTML - HTML in new Browser Tab or WIndow 浏览器扩展UI消失在窗口或选项卡开关上 - The browser extension UI disappears on a window or tab switch 如何打开新的浏览器窗口(不是选项卡),然后使用jQuery / Javascript调整其大小 - How to open new browser window (not tab) and then resize it using jQuery / Javascript 如何在Windows Phone 7浏览器中通过javascript打开新窗口或选项卡 - How to open a new window or tab via javascript in windows phone 7 browser 如何强制重定向到手机浏览器的新窗口或标签页? - How to force the redirection to a new window or tab in a mobile phone browser? 用户单击关闭选项卡时如何打开新窗口浏览器? - How to open new window browser when user click close tab? 如何使chromeapp在其窗口而不是浏览器的新标签页中打开 - How to make chromeapp open in its window instead of a new tab of browser
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM