3

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 3

3

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).
2
  • 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
  • 1
    It looks like the update and onUpdated methods might be useful in this case. Dec 7, 2012 at 0:23
6

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/

2
1

https://chrome.google.com/webstore/detail/url-pinner/lchefjdnocignejmkklgakfmnjhiimjh/related?utm_source=chrome-ntp-icon

This chrome extensions will automatically pin specific URLs when they are opened.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .