Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

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).
share|improve this answer
    
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. –  Anderson Green Dec 7 '12 at 0:21
1  
It looks like the update and onUpdated methods might be useful in this case. –  Anderson Green Dec 7 '12 at 0:23

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.

share|improve this answer

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/

share|improve this answer
    
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. –  Anderson Green Dec 7 '12 at 0:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.