Add or edit entry in Firefox history

2

3

Deleting an entry in the Firefox history is a simple matter, but how can I add or edit a URL (or URI) in the history?

palswim

Posted 2018-01-30T14:41:27.407

Reputation: 2 793

Answers

5

You can directly manipulate the SQLite database which stores the history, which you can find in the places.sqlite file in your Firefox profile folder. You can use the SQLite Manager add-on, DB Browser for SQLite, the sqlite3 software package on Linux, or another SQLite tool of your choice.

Upon the places.sqlite database, to insert a history entry, run the command:

INSERT INTO moz_places (url,title,rev_host,last_visit_date,guid,url_hash) VALUES('https://example.com/','Example Title','moc.elpmaxe.',strftime('%s','now'),GENERATE_GUID(),hash('https://example.com/'))

To update:

UPDATE moz_places SET url = 'https://example.com/', url_hash = hash('https://example.com/') WHERE id = #### -- auto-incrementing integer ID

Note that Firefox itself defines the hash and GENERATE_GUID functions, so even if you opted to use a SQLite tool other than the SQLite Manager extension, you will still need a different Firefox instance with this add-on. In this separate instance, you can run commands to compute the hash value or generate the GUID, and then copy those values in place of their calls in the previous SQL statements.

SELECT hash('https://example.com/')
SELECT GENERATE_GUID()

palswim

Posted 2018-01-30T14:41:27.407

Reputation: 2 793

Firefox added the url_hash column in Firefox 50, so this solution works for Firefox 50 and later (currently Firefox 57 at the time of writing).

– palswim – 2018-01-30T14:44:07.293

2

You can use https://github.com/bencaradocdavies/sqlite-mozilla-url-hash (C) or https://gist.github.com/boppreh/a9737acb2abf015e6e828277b40efe71 (Python) to calculate the url_hash.

– BoppreH – 2018-08-30T19:38:19.517