I have a math stack exchange account and so does my roommate. However, we cannot switch users on our shared computer without erasing the cookies, history etc. in our browser. Everytime we log out then click back log in it take us to the page where it asks how we want to log in. Then when we click on stack exchange it auto logs in whoever was last logged in. Please help we don't like having to clear the browser's memory everytime. THANKS!

  • 1
    $\begingroup$ Yes, that is annoying. There's a workaround: use two different browsers. $\endgroup$
    – 75064
    Commented May 3, 2013 at 3:10
  • 6
    $\begingroup$ Or, if you use any of the more recent browsers, keep "Private Browsing" turned on always. Do you really want your roommate to have access to all your cookies and history? All the "public" computers in the libraries of my current institution have "private browsing" turned on by default for all times. $\endgroup$ Commented May 3, 2013 at 8:31
  • 4
    $\begingroup$ Why not just have two separate user accounts on the PC, so that you have totally separate cookies, history, passwords etc. Assuming you are using Windows, Mac or Linux, this would be strongly recommended anyway for privacy and security. $\endgroup$
    – Old John
    Commented May 4, 2013 at 15:05

1 Answer 1


I don't know what browser you're using... this will work on IE and many (or all) versions of Firefox. Since it is using Javascript, it will probably work on most other browsers as well.

Read through all the steps to make sure you understand it before you begin.

Here is a piece of Javascript code you will need for the next steps:

javascript:(function(){C=document.cookie.split("; ");for(d="."+location.host;d;d=(""+d).substr(1).match(/\..*$/))for(sl=0;sl<2;++sl)for(p="/"+location.pathname;p;p=p.substring(0,p.lastIndexOf('/')))for(i in C)if(c=C[i]){document.cookie=c+"; domain="+d.slice(sl)+"; path="+p.slice(1)+"/"+"; expires="+new Date((new Date).getTime()-1e11).toGMTString()}})()

Part-1, the setup, you only need to do this part one time:

  1. Select the entire Javascript code from above (including the word "javascript:") and copy it to the clipboard.
  2. Create any favorite (bookmark) in your browser favorites. It doesn't matter where the favorite is linked to because we will replace the link in the favorite in the next steps.
  3. Locate the Favorite and rename it to Clear site cookies or whatever you like.
  4. Click to open the Properties for the new Favorite.
  5. Move to the URL field and delete the URL in the textbox.
  6. Paste the Javascript code that you copied to the clipboard in Step 1 into the URL textbox from Step 5
  7. The pasted text should...
    begin with: javascript:(function
    and end with: toGMTString()}})().
    If it doesn't, redo the copy and paste operations.
  8. Save the favorite, and answer Yes if you are prompted ... Do you really want to save this?
  9. Move the favorite where you can easily find it in your favorites menu, or on your Favorites Bar.

You are done with the setup. Now...

Part-2, how to use it:

  1. Go to any page on math.stackexchange.com. You can use this to clear the cookies on any Stack Exchange site, or any other website.
  2. Log out of math.stackexchange.com if you are not already logged out.
  3. While still on the page at math.stackexchange.com (or whatever other website), click the Clear site cookies favorite.
  4. There will not be any indication that anything has happened, but the cookies for (only) that website will have been cleared.
  5. Click to log-in to the site.
  6. You will (should) be prompted to select your login method.
  7. Make your choice and then complete the login process.

I hope this helps you save your browser information.


You must log in to answer this question.

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