Skip to content

Instantly share code, notes, and snippets.

@jscher2000
jscher2000 / scroungehistory.js
Created June 18, 2017 17:33
Console Script to Scrounge Title and URLs from a Firefox Session History File
/* Open old session history file in a tab, open the web console, paste all of this, press Enter to execute.
If popup is blocked, allow popups then try again. */
function scrub(t){t=t.replace(/&/g,'&amp;'); t=t.replace(/>/g,'&gt;'); t=t.replace(/</g,'&lt;'); return t;}
if (window.confirm('Scrounge session URLs?')) var newwin=window.open();
if (newwin){
newwin.document.write('<!DOCTYPE html>\n<html><head><title>URLs Scrounged from Session History</title><meta http-equiv=\'Content-Type\' content=\'text/html; charset=UTF-8\'><style>.urllist>p{margin-left:2.25em}.urllist>p:nth-of-type(1){margin-left:0}</style></head>\n');
newwin.document.write('<body><h1>URLs Scrounged from Session History</h1>\n');
var out=new Array();
var sess=document.body.textContent.split('"_closedWindows":[');
console.log(sess.length);