Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

How to set exceptions for automatic cookie-clearing on closure?

  • 21 replies
  • 6 have this problem
  • 12 views
  • Last reply by james235

more options

Firefox is forgetting my two-step google logins. On the google two-step verification page, there's a checkbox which says "Don't ask for codes again on this computer."

But firefox keeps asking for codes.

i have firefox set to clear cookies on closing.

i also have the urls below set as exceptions, in two places:

    -in about:permissions, they are all set to allow, and also to keep offline data without asking
    -in options/privacy/exceptions

mail.google.com maps.google.com calendar.google.com www.google.com shopping.google.com plus.google.com

  • .google.com

google.com gmail.com

this forum is messing up my list, above. Each url is a separate item in exceptions. The bulleted one actually starts with a star. (good job mozilla, thanks for this ancient text editor)

how do clear all cookies EXCEPT the ones above, when i close firefox? Or, is this not a cookie problem?

do i need to include "http://"

this article did not help https://support.mozilla.org/en-US/questions/974020

Firefox is forgetting my two-step google logins. On the google two-step verification page, there's a checkbox which says "Don't ask for codes again on this computer." But firefox keeps asking for codes. i have firefox set to clear cookies on closing. i also have the urls below set as exceptions, in two places: -in about:permissions, they are all set to allow, and also to keep offline data without asking -in options/privacy/exceptions mail.google.com maps.google.com calendar.google.com www.google.com shopping.google.com plus.google.com *.google.com google.com gmail.com this forum is messing up my list, above. Each url is a separate item in exceptions. The bulleted one actually starts with a star. (good job mozilla, thanks for this ancient text editor) how do clear all cookies EXCEPT the ones above, when i close firefox? Or, is this not a cookie problem? do i need to include "http://" this article did not help https://support.mozilla.org/en-US/questions/974020

Modified by johnyradio

Chosen solution

Exception only work if you let the cookies expire and won't work if you clear all cookies manually or via "Clear history when Firefox closes" or via "Clear Recent History". In that case all cookies will be removed or in case of "Clear Recent History" for the specified range. There is no difference between letting the cookies expire when you close Firefox (i.e. make them session cookies) or remove the cookies when you close Firefox, but the latter won't let you keep cookies with an allow exception while the former does honor exceptions and keeps such cookies.

Read this answer in context 👍 0

All Replies (20)

more options

Let all cookies expire when you close Firefox.

  • Firefox/Tools > Options > Privacy > Cookies: Keep until: I close Firefox

Create a cookie 'allow' exception for cookies that you would like to keep.

  • Firefox/Tools > Options > Privacy > Cookies: Exceptions

In case you are using "Clear history when Firefox closes":

  • do not clear the Cookies
  • do not clear the Site Preferences

Note that clearing "Site Preferences" clears all exceptions for cookies, images, pop-up windows, software installation, and passwords.

Clearing cookies will remove all specified (selected) cookies including cookies with an allow exception that you would like to keep.

more options

Please read my question.

You gave me a stock answer, without reading my question.

as i said, i DID create the exceptions.

but then you say "Clearing cookies will remove all specified (selected) cookies including cookies with an allow exception that you would like to keep."

ok, what is the point of that?

how do i create exceptions to NOT clear certain cookies on closing, but to clear all other cookies?

more options

Chosen Solution

Exception only work if you let the cookies expire and won't work if you clear all cookies manually or via "Clear history when Firefox closes" or via "Clear Recent History". In that case all cookies will be removed or in case of "Clear Recent History" for the specified range. There is no difference between letting the cookies expire when you close Firefox (i.e. make them session cookies) or remove the cookies when you close Firefox, but the latter won't let you keep cookies with an allow exception while the former does honor exceptions and keeps such cookies.

more options

"letting the cookies expire when you close Firefox (i.e. make them session cookies)"

ok, when do session cookies expire?

thx

more options

Use this setting:

  • Firefox/Tools > Options > Privacy > Firefox will: "Use custom settings for history": Cookies: Keep until: I close Firefox
more options

Hi johnyradio, you asked:

when do session cookies expire?

General Rule: Session cookies expire when you exit Firefox.

Exception: For tabs you still have open, session cookies are retained so you can resume your session later. Which ones?

  • If you have Firefox set to do that automatically start up with your previous session windows and tabs, cookies will be retained both for secure and non-secure sites.
  • If you have Firefox set to start up with a specific page (home page, blank page), then the secure site cookies are not retained in the session storage file, just the non-secure site cookies.

Modified by jscher2000 - Support Volunteer

more options

That worked. (no, it didn't)

It's very confusing that Firefox has settings for how to handle cookies on closing in three different places. They should change that.

"Keep until I close Firefox" seems redundant with "Clear History when Firefox closes" with "Cookies" checked. Then there are settings in "about:permissions". No way to know which one takes precedence. That's poor user-design.


For others having this problem, here's a clear explanation. However, this is only PART of the fix, hoping to find the complete fix later in this thread.

You CAN make FF keep only certain cookies on closing, and erase all others. Here's how to set all cookies to be cleared as soon as you close firefox, except your exceptions:

  1. Go to Tools > Options > Privacy.
  2. Under "History", pick "Firefox will Use custom settings for history"
  3. Click "Exceptions", and add the cookies you want to keep. Click "Close"
  4. Click "Keep until I close Firefox"
  5. If you have "Clear History when Firefox closes" checked, then:
  • Click "Settings"
  • Uncheck "Cookies", and click "OK".

6. Click "OK" to close the settings box.

(now this forum has a formatting toolbar, thx! why didn't have one before?)

Modified by johnyradio

more options

"For tabs you still have open, session cookies are retained so you can resume your session later."

--even if i have cookies set to erase when i close FF?

"If you have Firefox set to do that automatically, cookies will be retained both for secure and non-secure sites."

--do WHAT automatically?

more options

Yes, if you use "Show my windows and tabs from last time" then cookies from open tabs are stored in the sessionstore and not removed by using "Clear history when Firefox closes".

You can set the browser.sessionstore.privacy_level pref to 2 (never) or 1 (non-HTTPS) on the about:config page to disable saving cookies via session restore.

The browser.sessionstore.privacy_level_deferred pref is used when you do not reopen the previous session automatically via "Show my windows and tabs from last time" and uses the same values.

more options

I clarified my earlier description.

The session restore feature was designed to make crashes less painful by restoring the tabs you had open at the time of the crash in as close as possible condition to when Firefox crashed. This includes maintaining your session cookies for those sites.

And it carries over to regular shutdowns, with the variation for secure sites described above.

But if you use the feature to "Clear history when Firefox closes" and select cookies, that should override the normal session storage behavior and flush even the non-secure session cookies from the file.

Someone should create a flow-chart.

more options

ok, no, i was wrong, this did not fix it. firefox still not remembering my gmail login.

  • i keep getting the screen that says "One account. All of Google.
  • Sign in to continue to Gmail".
  • Then i have to go back to "Manage accounts", and then re-add the accounts it forgot.
  • Then i have to re-do the cellphone verification, even tho i checked the box that said "don't ask to verify this computer" last time i did it.

i DO show my windows from last time, but that's for other sites, not google. i do NOT keep gmail open all the time, and i do not want to keep google open all the time. i should not have to keep a website open all the time for firefox to keep the cookies.

more options

"You can set the browser.sessionstore.privacy_level pref to 2 (never) or 1 (non-HTTPS) on the about:config page to disable saving cookies via session restore. The browser.sessionstore.privacy_level_deferred pref is used when you do not reopen the previous session automatically via "Show my windows and tabs from last time" and uses the same values.

Why do i need to do any of that? will this fix my problem, or just confuse me more?

more options

"The session restore feature was designed to make crashes less painful"

it's nice of firefox to keep cookies for tabs that i have open, when it does a tab-restore.

but let's assume i'm not doing a tab-restore.

Modified by johnyradio

more options

Create a Google exception for the base domain

google.com

That should cover all the important cookies regardless of server.

more options

"Create a Google exception for the base domain"

yes, as i said in my OP, i did that.

Modified by johnyradio

more options

Just to recap:

  • Your default is session cookies. On the Privacy tab:
    Accept cookies from sites
     Accept third party cookies: Always
     Keep Until: I close Firefox
  • In the Exceptions dialog, you have an Allow entry for google.com and no Block entries that would conflict
  • You are not clearing cookies at shutdown. On the Privacy tab, either:
    - Clear history when Firefox closes is not checked, or
    - In the Settings dialog, Cookies is not checked
  • You do not have any add-ons or external software that clears cookies on shutdown.

When you visit Google, check that the cookies are not set to expire at the end of the session. While viewing a page on the site, try either:

  • right-click and choose View Page Info > Security > "View Cookies"
  • Alt+t (open the classic Tools menu) > Page Info > Security > "View Cookies"
  • click the padlock icon in the address bar > More Information > "View Cookies"

Firefox display the expiration in the lower part of the dialog as you select a cookie.

more options

"just to recap"

   Your default is session cookies. On the Privacy tab:
  • Accept cookies from sites - CHECK
  • Accept third party cookies: Always - CHECK
  • Keep Until: I close Firefox - CHECK
  • In the Exceptions dialog, you have an Allow entry for google.com and no Block entries that would conflict - CHECK
  • You are not clearing cookies at shutdown. On the Privacy tab, either Clear history when Firefox closes is not checked, or In the Settings dialog, Cookies is not checked - CHECK
  • You do not have any add-ons or external software that clears cookies on shutdown. - CHECK. I tested this in Safe Mode.
  • When you visit Google, check that the cookies are not set to expire at the end of the session. - CHECK - there are many google cookies. Some are set to expire at end-of-session, some at a particular time today, and some months from now. (i notice some of the cookies in this list are for other non-google sites open in other windows. That's confusing.)

Part of the weirdness is that ONE of my three google accounts is remembered in firefox. But not the other two.

Modified by johnyradio

more options

I'm not familiar with features to keep multiple Google accounts logged in simultaneously. (I try to keep my Google accounts as separate as humanly possible.) Does it work in Internet Explorer?

more options

it's not about keeping them all logged in simultaneously.

the pic shows how google does this. When i restart firefox, only the first account is remembered on this screen, and i have to re-add the other ones.

more options

This is a little messy but... I can't think of any easier way to compare the cookies between sessions.

If you open Firefox's web console (Ctrl+Shift+k), then load a Google page, you should get a list of URLs of the page you requested and the various linked in resources. You may want to reload bypassing the cache (Ctrl+Shift+r) to clean a set of requests as possible.

Then if you click the page URL, a small dialog should pop up with request and response headers, and a section showing the cookies sent to the server with that request. Could you copy out the cookies section into a document for comparison (i.e., before you shut down, versus after you resume).

  1. 1
  2. 2