我做了一个a small Chrome extension,它可以打开一个新的标签,并在其中显示你的书签。
我想这个新标签自动固定。代码如下:
chrome.tabs.create({
"url": chrome.extension.getURL("skwares.html")
},
function(tab) {
tab.highlighted = true;
tab.active = true;
tab.pinned = true;
});
新选项卡打开正常,但未固定。我错过了什么?
1条答案
按热度按时间iyfjxgzm1#
你只需要将pinned选项移到create属性中,而不是回调:
另外,在默认情况下,当你创建一个新标签时,“active”会被设置为true,所以你不需要再次设置它。