Mozilla Firefox: how to restore deleted site/thumbnail on New Tab
Firefox now features a nifty "new tab page". You can drag around the thumbnails, remove them...oops, I accidentally removed one, how do I get it back?
The options according to Mozilla don't sit well with me. There must be a better way to do it!
From http://www.codinghorror.com/blog/2012/04/learn-to-read-the-source-luke.html
Read the source, I did. Reading through the XUL script and its relevant dependency, I was pleasantly surprised by the well-documented code. I was also surprised to see some cutting-edge JS like const
and let
.
Back to the code: the term in the code for removing links from the new tab is to "block" them. These are "saved" too so the removal persists between browser sessions. At this point the API to block/unblock links was fairly obvious. The procedure below illustrates the API in action:
Go to Tools -> Web Developer -> Web Console, or hit Ctrl-Shift-K.
Type gBlockedLinks.links (should autocomplete as you type) hit Enter. A mass of URLs should show up on the console.
You'll need to have the URL you want to restore handy - character-for-character. You may look for it like this:
gLinks.getLinks().filter(function(link) { return link.url.match(new RegExp("faceBOOK","i")); });
where the
i
in theRegExp(...)
on the first line says to "search case-insensitively" (sofacebook
would match).I didn't have much luck selecting the URL from the output in the previous step, so you'll most probably be typing it character for character.Keep tuning the search string till you've whittled it down to one or two. Then press UP and add this in front of the line:
var links = ...
Check that the URL is indeed blocked with
gBlockedLinks.isBlocked(links[1])
where the
1
is for the second link (count from 0) - it should returntrue
.drum-roll Press UP and replace
isBlocked
withunblock
, so the command looks likegBlockedLinks.unblock(...)
. VoilĂ ! Refresh your new tab page.