对于我的Chrome扩展程序,我需要在“活动/当前”标签旁边打开一个新标签。但是tab.create
方法总是将选项卡附加在选项卡列表的末尾。
Firefox具有relatedToCurrent
设置标签位置的属性。
在活动标签旁边打开标签是否有与Chrome等效的标签?
您可以使用“ index”属性在调用chrome.tabs.create()函数时指定位置。如果要在当前选项卡旁边打开一个新选项卡:
chrome.tabs.query({
active: true, currentWindow: true
}, tabs => {
let index = tabs[0].index;
chrome.tabs.create({
...,
index: index + 1,
...
}, tab => {
...
});
}
);
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句