22

Is there a way to set up Firefox in a way that it absolutely never removes any items from its history (automatically)?

In the past maybe there were a 'keep all history items', then you could set it from menu to a big integer like 999999999 in days.

Since, first unnoticed, this setting was gone, I currently resolved to backing up places.sqlite (on win, in %Appdata%\Mozilla\Firefox\Profiles\<some-profilename>\places.sqlite).

Let's say I won't upgrade without checking that my backup method still works:

How can one today set Firefox v22 to keep all history items?

I've already set these values in about:config.

places.history.expiration.transient_current_max_pages;104858
places.history.expiration.transient_optimal_database_size;85534800

still I have bookmarks older than the oldest history item in the database; although I cannot recall when I set these settings!

So is this sufficient? Are these good values? Are there other or better ways to do this (eg. an addon).

animuson
  • 273
  • 1
  • 3
  • 16
n611x007
  • 6,336
  • 14
  • 61
  • 88
  • Why do you want to do this? (keep all history items ever, that is) – Richard Lucas Sep 19 '13 at 13:49
  • 4
    @Richard I remember doing things far away in the past but cannot recall exact URLs. I recall them longer than these artificial history file&time limit in history. Chances are I haven't bookmarked a site that was of no interest to me then but is of interest now. And I really don't like to start searching for something that I've already found once and found good enough to remember it, as time has told at this point. And I want to keep this data locally, because it's noone else's business. – n611x007 Sep 19 '13 at 13:56
  • I can see why you would want to do this but I suspect you'll be running the risk that Firefox will clear out your history at some point, I can't see that the history list could just keep accumulating forever without impacting system performance. Personally I'd consider some external database of visited pages, but that is just me. Good luck! – Richard Lucas Sep 19 '13 at 14:58
  • Use Evernote to store the useful information. Then add tags to create an organized and easy to find stuff system. Otherwise just put in as many 9's as the entry allows and you should be ok. – cybernard Sep 20 '13 at 04:34
  • 1
    @cybernard about Evernote, there is no point, I mean I could just use bookmarks, but the problem is that at the time of visiting I cannot foresee the value of the page on the coming days; bookmarks would be easier than taking a note and I do use a lot of bookmarks but here I need exactly the ones that I didn't bookmarked/noted. About entry, you mean the about:config entries? Is it from experience that Firefox respects them? Putting in as much 9s as possible sounds like [Cargo Cult](https://en.wikipedia.org/wiki/Cargo_cult_programming) and if it's proven ineffective, I will be left empty handed – n611x007 Sep 20 '13 at 09:47
  • 1
    Since the release of Firefox 4.0.x, the number of days Firefox will retain history for is directly related to system hardware. Firefox calculates how much history to retain without impacting system performance. You can't change it anymore. – krowe Sep 21 '13 at 04:59
  • @krowe, could you add a reference to this information perhaps? By the way it sounds crazy... On the other hand, what does the above two config option do then? – n611x007 Sep 21 '13 at 08:16
  • 1
    as far as code goes for reliability: https://mxr.mozilla.org/mozilla-central/ident?i=PREF_READONLY_CALCULATED_MAX_URIS reading this, currently Firefox will *delete from the database if disk space goes low*, and won't allow a database bigger then 160mb. I don't like this at all. :( But I don't understand: is it overridden by my config? – n611x007 Sep 21 '13 at 09:59
  • executive culprits: [QUERY_EXPIRE_URIS](https://mxr.mozilla.org/mozilla-central/search?string=QUERY_EXPIRE_URIS) and [EXPIRATION_QUERIES](https://mxr.mozilla.org/mozilla-central/search?string=EXPIRATION_QUERIES&find=&findi=&filter=^[^\0]*%24&hitlimit=&tree=mozilla-central) - wonder *if there is* a ***design document*** for this behaviour? – n611x007 Sep 21 '13 at 10:12
  • 2
    reference for firefox deleting history based on system: https://wiki.mozilla.org/Firefox/Projects/Places_async_expiration – Achal Dave Apr 06 '14 at 22:12
  • Did you try to increase `places.history.expiration.max_pages`? – user Jan 09 '15 at 19:41
  • 2
    @AchalDave, I believe that link is about a future project. Whereas current implementation is described at [developer.mozilla.org/en-US/docs/Mozilla/Tech/Places/Places_Expiration](https://developer.mozilla.org/en-US/docs/Mozilla/Tech/Places/Places_Expiration) – user Jan 09 '15 at 19:45

4 Answers4

8

There is now a proper solution (Firefox v40): places.history.expiration.max_pages will override the 'optimal database size' calculations, so setting it to a large positive value should get the desired effect.

See this answer.

Cauterite
  • 452
  • 5
  • 11
  • It's in *v4*. change blames [30fcd9794eb2](https://hg.mozilla.org/mozilla-central/rev/30fcd9794eb2) 2010-01-15 "part10", bugging [520165](https://bugzilla.mozilla.org/show_bug.cgi?id=520165) targets mozilla1.9.3a1 refs [Places async expiration](https://wiki.mozilla.org/Firefox/Projects/Places_async_expiration). closest thing I found in bookmarks is [GECKO193a3_20100315_RELBRANCH](https://hg.mozilla.org/mozilla-central/shortlog/a608ba89e49d) which was tagged with [FIREFOX_4_0b11_RELEASE](https://hg.mozilla.org/mozilla-central/rev/c32325744c16) since 2011-02-03. I confirm 4.0b11 has this logic. – n611x007 Nov 04 '15 at 09:11
  • so do you think `places.history.expiration.max_pages` (1) is more effective than `places.history.expiration.transient_current_max_pages` (2) that I've already set in OP? why? specifically what links `const PREF_MAX_URIS = "max_pages";` to (1), but avoids (2)? I shall either confirm that (1) and PEX__loadprefs() is effective or confirm that if I shrink free space to 0, history remains with (1) set but goes with (1) unset. – n611x007 Nov 04 '15 at 09:18
  • 1
    Good lord that's a terse comment °~° @n611x007: what links `PREF_MAX_URIS` to (1) is `PREF_BRANCH = "places.history.expiration."`. `max_pages` is fetched relative to the `.exipration` branch — see [line 461](https://dxr.mozilla.org/mozilla-central/source/toolkit/components/places/nsPlacesExpiration.js#461) and [line 760](https://dxr.mozilla.org/mozilla-central/source/toolkit/components/places/nsPlacesExpiration.js#760), – Cauterite Nov 04 '15 at 09:56
  • 1
    I have reason to believe that setting `transient_current_max_pages` has no effect on history expiration. nsPlacesExpiration.js never actually reads it, only writes to it as a means of exposing the current history limit for other components to read. `places.history.expiration.max_pages` is what actually controls expiration. – Cauterite Nov 04 '15 at 09:59
  • As of Firefox v53.0 there's no more `places.history.expiration.max_pages` in about:config, and `places.history.expiration.transient_current_max_pages` looks like frozen, I cannot change its value (I have Norwell add-on enabled but it should't matter). – Joel.O Apr 30 '17 at 18:28
  • 1
    @Joel.O did you read [/a/895302/995459](/a/895302/995459) ? It says "`.max_pages` doesn't exist by default, you have to create it" and "`.transient_current_max_pages` should automatically adjust itself to match your `.max_pages` setting" – Cauterite May 01 '17 at 00:07
  • Thanks you're right @Cauterite. It now works creating a new setting `places.history.expiration.max_pages` setting it as integer and putting 999999 as value. The `places.history.expiration.transient_current_max_pages` adjusts itself to it. Strange that we have to *create* the preference though. – Joel.O May 02 '17 at 07:47
  • Take note that `max_pages` *still* has some [caveat](https://superuser.com/a/1405880/567466). – mirh Jun 07 '20 at 15:22
4

You could run a private Firefox Sync server, and set the History retain size to 1 GB, or something insane like that. As far as I know, it will not delete history, and you'll be able to see that entire history on any browser instance you sync.

trapezoid
  • 197
  • 5
  • Where do I set the History retain size (in either Firefox or weave-minimal)? I've checked Firefox options/sync but I only saw quota read, and command-line options to `weave-minimal` but I haven't seen one regarding history retain size. – n611x007 Oct 18 '13 at 06:50
  • Note: weave-minimal doesn't support the current sync API. You can still run your own instance of the official sync server, but it doesn't have many configurable options — you'd have to patch it to apply a custom history retention policy (I haven't looked any further into it). – Cauterite Nov 04 '15 at 11:10
3

In the palemoon forum from user341084's answer, there was a link to expire-history-by-days add-on - which has an option to disable expiration completely (or define expiration period).

chukko
  • 133
  • 4
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link answers can become invalid if the linked page changes. – CharlieRB Jan 09 '15 at 20:40
  • 1
    I agree - but the link is not to a solution but to a plugin, and the name of the link is the name od the add-on, so there is nothing else i could put here. – chukko Jan 10 '15 at 21:33
  • 1
    That option in the add-on simply sets `places.history.expiration.max_pages` to `999999`. – user Nov 04 '16 at 08:33
2

I had the same issue and I discovered a hacky way which you can read about here: http://forum.palemoon.org/viewtopic.php?t=3260

The tl;dr version is, use mozilla.cfg to lock the variable places.history.expiration.transient_current_max_pages to 2147483647 (the largest value accepted). The issue is that Firefox will change that setting automatically unless you lock it.

Note that mozilla.cfg does not work in Portable Firefox, so in such a situation I recommend using Portable Pale Moon instead (which does work with mozilla.cfg)

You can find info on using mozilla.cfg here: http://kb.mozillazine.org/Locking_preferences

This technically doesn't set it to keep history forever, but it'll retain a heck of a lot of entries. I currently have history going back 18 months now and my places.sqlite file (which retains the history) is over 150 MB (6 months ago it was about 100 MB, so for me I add 50MB every 6 months). Note that, with such large sizes, an SSD is HIGHLY recommended. If you don't have one then consider using a ramdisk + symbolic links instead (a ramdisk that saves data at timed intervals or at shutdown).

Also, it may be a good idea to make backups of your history file in case it borks out or something. Then again, it's a good idea to make entire hard drive backups as well...

NM64
  • 136
  • 1
  • 2