2

I have several accounts for a website and currently I want to write an extension that I can open all the accounts simultaneously in chrome, each tab for one account.

So that means I want each tab with a separate cookie system, is it doable? If so please suggest the API I should use, thanks!

Bin Chen
  • 61,507
  • 53
  • 142
  • 183

3 Answers3

3

Go to Chrome Preferences. There is a Users section where you can add users. Each new user will have its own cookie jar, so you can log in to a site as many different users at once. It makes new chrome windows, but it seems you cannot drag a tab onto a window of another user.

enter image description here

Julian Mann
  • 6,256
  • 5
  • 31
  • 43
2

According to Chrome documentation, you can modify HTTP headers (including cookies) in the onBeforeSendHeaders event handler. So, you need to store new cookies for every account by means of the onHeadersReceived event handler, and then substitute them for every tab in outgoing requests.

There even exists an extension which seems doing almost the thing you want - Chrome Cookie Switcher.

Also I have found an answer that may be helpful for your task: Associate a custom user agent to a specific Google Chrome page/tab.

Community
  • 1
  • 1
Stan
  • 8,683
  • 9
  • 58
  • 102
-1

I really don't think Chrome allows extensions to do this. If I recall correctly, extensions can inspect and block requests, but they can't modify them, such as changing cookies on the fly for each tab.

I suggest you use the --user-data-dir command-line option of Chrome. It allows you to keep several separate profiles, each in its own directory, and then you only need to start chrome with the proper option:

# run this command to use the first profile
google-chrome --user-data-dir=/home/binchen/my_chrome_profiles/my_profile_1

# run this command to use the second profile
google-chrome --user-data-dir=/home/binchen/my_chrome_profiles/my_profile_2

...

Each profile will be in its own Chrome window, with its own cookie store, instead of its own tab, but it's easier than writing an extension.

Lastly, if the website you're mentioning is Google, you can keep several Google accounts open at the same time.

guillaume
  • 1,380
  • 10
  • 15
  • how do you then tell the windows apart(which is for which account) from looking at chrome's window list in the taskbar? http://i.imgur.com/W2VlDrN.png – barlop May 13 '13 at 20:02
  • I don't. I can tell them apart because I put them on different virtual desktops (I don't know if Windows can have such functionality) so I move left or right to use one particular instance. – guillaume May 16 '13 at 12:04
  • but how do you know which virtual desktop has which one? there is a program called goscreen that creates virtual desktops labelled 1,2,3,4. – barlop May 16 '13 at 21:44
  • I just remember it. I only have a few instances so it's okay. In addition to the spacial positioning on the virtual desktop grid, you may want to theme Chrome differently in each instance – guillaume May 17 '13 at 12:50