英文:
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!
答案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 });
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。



评论