How to Set Firefox 4 to only store History for a set period of time, i.e. one day?

Solution 1:

Too bad, it seems one can no longer use browser.history_expire_days to force the cache to be deleted. Written in January 2010:

Originally expiration was managed by History component itself on three major steps: after each visit, during idle, at shutdown. [..] The new component is a JS component, it runs expiration in steps, every 3 minutes, with a simple adaptive algorithm, so that if the last step did not expire enough, the next one will be run later, while if it finds more items than the expired ones, the next step will expire more!

Somehow the Firefox folks think limiting history is just about performance, not about privacy:

The new component is able to detect your hardware specs, especially memory size, and adapt expiration to it, this means you don't need anymore to tweak number of days of history, or whatever.

And so:

[..] hidden expiration preferences have gone, so browser.history_expire_days, browser.history_expire_days_min, browser.history_expire_sites are now replaced by a single places.history.enabled preference.

...though:

[..] two new hidden preferences: places.history.expiration.interval_seconds is number of seconds between each expiration step, while places.history.expiration.max_pages is maximum number of pages that we will retain before expiring.

(In old versions one could go into about:config and change browser.history_expire_days and browser.history_expire_days_min. The latter is still present in Firefox 4 beta on my Mac, but probably not used. The first is gone altogether. In the older versions, according to some article, one might actually have wanted to add browser.history_expire_days manually.)

Note that deleted history entries might in fact still be stored in the database places.sqlite, just being marked as deleted. Vacuuming that file compacts it, removing everything that is supposed to be deleted. And as an aside: this is not all history that is kept on your computer. Like Flash keeps its own trail too.

Solution 2:

You can use the Expire history by days extension to restore the functionality.

Solution 3:

If you type about:config in your address bar and then filter for history you'll find the entries browser.history_expire_days and browser.history_expire_days_min. Try setting those to 1 day.

I'm not using Firefox 4, so I can't test this now, but I assume those options are still present.

Solution 4:

History expiration is now controlled in an unusual way:

Expiration is based on hardware specs, specifically on memory size and CPU cores. This means on mobile and old systems expiration will be more aggressive than on high-end hardware, to try keep the database size at a reasonable (and performant) value.

But it is still configurable via about:config preferences, use this one:

places.history.expiration.max_pages: The maximum number of pages that may be retained in the database before starting to expire. Default value is calculated on startup and put into the places.history.expiration.transient_current_max_pages preference. This transient version of the preference is just mirroring the current value used by expiration, setting it won't have any effect.

So you can make its value smaller or greater to shorten or prolong expiration time correspondingly.