firefox logo

Get more out of the Firefox history

Have you ever been annoyed by the fact that Firefox only shows the last visit to a website in the history and no advanced search options such as AND- or OR-queries?

Perhaps you have ever wanted to know exactly when and how often you have visited a particular website. Whether to document your working hours, to track a search or simply to better understand your online habits - there are many reasons to query and filter more detailed information about your web activities.

Fortunately, Firefox stores more information than is displayed in the history - namely in an SQLite-Database-file called places.sqlite.

This information can be accessed with any database client that supports access to SQLite databases. Since I use the IntelliJ development environment on a daily basis, I personally use the IntelliJ Database Explorer. All you have to do here is add a new SQLite data source and enter the path to the places.sqlite enter. In Windows this is under C:\Users\<Benutzername>\AppData\Roaming\Mozilla\Firefox\Profiles\<Profilordner>\places.sqlite
e.g. C:/Users/mfischer/AppData/Roaming/Mozilla/Firefox/Profiles/8absuz37.default-release/places.sqlite.

In the SQL console window, you can now use a join to access the tables moz_places and moz_historyvisits execute any queries.

Use the following SQL command, for example, to determine all history entries for the current day:

SELECT  
    datetime(v.visit_date / 1000000, 'unixepoch', 'localtime') AS visit_date,  
    p.title,
    p.url
FROM  
    moz_places p  
    JOIN moz_historyvisits v ON p.id = v.place_id  
WHERE date(datetime(v.visit_date / 1000000, 'unixepoch', 'localtime')) = date('now', 'localtime')
ORDER BY visit_date DESC;  

Example output:

visit_datetitleurl
2024-08-26 15:58:12What comes after Scrum? An outlook on the future of agile methods - Business Software and IT Blog - We shape digital value creationhttps://staging.blog.doubleslash.de/software-technologien/it-projektmanagement/was-kommt-nach-scrum-ein-ausblick-auf-die-zukunft-agiler-methoden
2024-08-26 15:50:50Secure Password Share from doubleSlashhttps://www.secure-password-share.de/en/
2024-08-26 15:50:43doubleSlash Net-Business GmbHhttps://www.doubleslash.de/en/
2024-08-26 15:50:38doubleSlash IT Business and Software Bloghttps://staging.blog.doubleslash.de/
2024-08-26 15:50:29What comes after Scrum? An outlook on the future of agile methods - Business Software and IT Blog - We shape digital value creationhttps://staging.blog.doubleslash.de/software-technologien/it-projektmanagement/was-kommt-nach-scrum-ein-ausblick-auf-die-zukunft-agiler-methoden
2024-08-26 15:50:19doubleSlash IT Business and Software Bloghttps://staging.blog.doubleslash.de
2024-08-26 15:50:19http://staging.blog.doubleslash.de/
2024-08-26 15:50:03test - Google Searchhttps://www.google.com/search?client=firefox-b-d&q=test

If instead you want to view the entire history using AND- or OR-queries via URL and title, this can be done as follows, for example:

SELECT  
    datetime(v.visit_date / 1000000, 'unixepoch', 'localtime') AS visit_date,  
    p.title,  
    p.url  
FROM  
    moz_places p  
    JOIN moz_historyvisits v ON p.id = v.place_id  
WHERE (  
		  p.url LIKE '%blog%'  
		  AND p.url LIKE '%doubl%'  
		  AND lower(p.title) LIKE '%scrum%'  
	  ) OR (  
	      lower(p.title) LIKE '%agile%'  
	      AND p.url NOT LIKE '%jira%'  
	  )
ORDER BY visit_date DESC;  

Addendum

If you also want to add a column that only contains the domain, you can simply adapt the above statements as follows:

SELECT  
    ...
    substr(  
        p.url,  
        instr(p.url, '//') + 2,  
        instr(substr(p.url, instr(p.url, '//') + 2), '/') - 1  
     ) AS domain
FROM  
    ...  

Conclusion

Firefox stores much more information about your web activities than the history shows at first glance. A database client makes it relatively easy to query this data in detail.

Cover image generated with the help of ChatGPT.

Matthias Fischer

About ME

Matthias Fischer has a degree in general computer science and has been working as a software developer at doubleSlash since 2006. He has cross-industry experience in IT projects and works with well-known customers such as Deutsche Post Direkt GmbH, BMW AGFederal Printing Office, ZF AG and Zeppelin Systems together. Matthias has extensive expertise in Spring Boot, Java EE and Angular. His main focus is on back-end development, but for some time now he has also been involved in front-end development with Angular. Matthias is also passionate about software quality, automated testing and agile development.

All contributions from Matthias Fischer

Learn more

Further information on our website and in our newsletter

Arrow up