Joh*_*ell 5 google-chrome-extension
对于我的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 => {
...
});
}
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1987 次 |
| 最近记录: |