小的Chrome浏览器标签使用JS

huangapple go评论60阅读模式
英文:

Small tab on Chrome browser using JS

问题

I just wanted to ask about the image below. I'm currently building a Chrome extension that opens the LinkedIn tab in a "small tab" style like the image below. I can't find any reference to this on other sites. Can anyone tell me how to achieve this using either Chrome APIs or JavaScript? I really need to learn how to achieve this.

Thanks in advance for the upcoming answers!

英文:

I just wanted to ask about the image below. I'm currently building a Chrome extension that opens the LinkedIn tab in a "small tab" style like the image below. I can't find any reference to this on other sites. Can anyone tell me how to achieve this using either Chrome APIs or JavaScript? I really need to learn how to achieve this.

Thanks in advance for the upcoming answers!

小的Chrome浏览器标签使用JS

答案1

得分: 2

你可以使用chrome.tabs API来实现这个功能。
具体来说,使用chrome.tabs.create(..)函数。

如果你查看文档,创建函数的第一个参数是新标签页的属性,你感兴趣的属性是pinned

这意味着为了获得所需的效果,你需要像这样使用:

chrome.tabs.create({ url: 'https://linkedin.com', pinned: true });
英文:

You can do that using the chrome.tabs API.
Specifically, the chrome.tabs.create(..) function.

If you take a look at the documentation, the create function accepts as the first parameter the new tab's properties, the propriety that you're interested in is pinned.

That means that in order to get the desired effect, you need to use something like this:

chrome.tabs.create({ url: 'https://linkedin.com', pinned: true });

huangapple
  • 本文由 发表于 2023年6月8日 13:27:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76428842.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定