There are some websites (such as http://superuser.com ) that I want Chrome to pin automatically whenever they are opened. Are there any Chrome extensions that can do this? Would it even be possible to implement this feature using a Chrome extension?
3 Answers
You can definitely write an extension to inspect the URL and set the pinned properties of each tab. Check out the url and pinned properties of Tab here:
https://developer.chrome.com/extensions/tabs.html
What you probably want to do is write an extension that does the following on startup:
load a list of designated url's
convert the url's to regex's somehow (pad with http, starts with?)
// checks if a pin matches and pins it
function pinIfMatches(Tab tab) {
for (each regex) {
if (tab.url matches regex) {
chrome.tabs.update(tab.id, { pinned : true });
}
}
}
chrome.tabs.onCreated.addListener(pinIfMatches);
chrome.tabs.onUpdated.addListener(function(Tab tab) {
// tab changed location and isn't already pinned
if (changeinfo.url != null && !tab.pinned) {
pinIfMatches(tab)
}
});
You need to:
- make sure the extension has the appropriate tab permission, and
- keep track of which url's are already pinned (to eliminate dupes).
-
Which of the functions listed on this page can be used to change an existing tab to a pinned tab? I'm still searching for it, and I haven't found it yet. Dec 7, 2012 at 0:21
-
1It looks like the
update
andonUpdated
methods might be useful in this case. Dec 7, 2012 at 0:23
Have you tried this command line switch?
chrome –-pinned-tab-count=4
OR
chrome –-pinned-tab-count=2 http://superuser.com/ http://www.google.com/reader/
Source: http://www.addictivetips.com/internet-tips/permanently-pin-tabs-in-google-chrome/
-
Is it possible to use this command to automatically pin tabs after they are opened? It looks like it would just open both URLs as pinned tabs, instead of converting existing tabs to pinned tabs. Dec 7, 2012 at 0:17
-
4This no longer work because of bugs.chromium.org/p/chromium/issues/detail?id=37596#c3 Dec 3, 2016 at 12:53
This chrome extensions will automatically pin specific URLs when they are opened.