Recover Closed Firefox Tabs Easily Using JavaScript

Guest Post by Quakeboy of TechTola.

Firefox PuzzleScenario:

  1. You are reading a web page Page A which is loaded in a “Firefox Tab”. Let us call the tab – Tab A.
  2. You are about to open a link on Page A in a new tab. You either hold down CTRL key and click on the link (OR) Right-click and select “Open link in new tab”. A new tab is created. Let us call the new tab – Tab B with page B loaded in it.
  3. Now as you think you no more need “Page A” (or) you are a clean person like me and hate cluttering of tabs (or) you were curious to see what the close button would do and so you close Tab A.
  4. After a while you realize you actually need to go back to Tab A and try to click on Browser’s Back button on Tab B and it is DISABLED !

Given that you don’t remember the URL of page A & you are not able to find a link back to page A. You might attempt the following things.

  • As a true Firefoxian at heart, you know where the recently closed tabs will be listed. So you click History > Recently closed tabs. If you are had not closed more than 10 tabs after that, you might find your tab listed there.
  • Or click History > Show all history and spend some time and finally succeed in finding it there.

As this has happened more than twice, I sat down trying to figure out a simple way in which I succeeded and so I am here to share it with you.

Solution: Create a custom back button !

IdeaRight click on your Firefox bookmarks tool bar and select “New Bookmark”. Fill in the name with “BACK !!”. That’s the name of our cool powerful back button. In the location box just copy & paste the script below and click Add.


Let me explain. First we say the browser its a JavaScript. Then we tell that the current window’s location has to be set to the current web page’s referrer. Referrer is a property of every web page and it has the URL of the page from which you came from. The property will be blank only, if you had typed the URL in the address bar of the browser and opened the page.

Create another bookmark the same way with a slightly modified JavaScript and try playing with it.


FYI – Alert is a built in JavaScript function for showing information in a message box. To learn more cool JavaScript functions you can head over to OpenJS or W3C School tutorials. Thanks for reading this article and hope this helps you 🙂

This article was written by Quakeboy. He blogs at TechTola where he writes about the Internet, the blogoshpere and shares useful Tips and Tricks. He writes in short bursts, with just the right amount of information you need. If you have something to say, you can write a guest post here.

Hello, I am Guest Author. Thank you for reading!

This entry was submitted by a guest author. If you wish to contribute, please contact me for my terms.

Divi WordPress Theme - My Review

Divi WordPress Theme
Divi is a WordPress theme that web designers do not want you to know. It comes with a drag-and-drop theme builder. You can build beautiful looking unique websites without touching a line of code. Just choose from one of the many pre-made layouts, or pick elements and arrange them any way you like.

Divi is every WordPress developer's wet dream. Surprise your clients with neat responsive websites and have fun building them.

Divi comes from Elegant Themes. If you enjoy building websites, you *need* an Elegant Themes membership. 87 beautiful themes and 5 plugins for the cost of less than a candy-bar each!

Note: I am an avid user of Divi myself and this is a honest review. I wouldn't recommend something that I do not personally find amazing.


  1. BlogrPro says:

    There is no need at all. Just right click on any tab and click “Undo Close Tab”. Last closed page will be opened and will be put in the exact order of tabs. Also u can do this continuously to open all closed tabs 1 by 1. But if the history is cleared, u can’t do this.

    • Quakeboy says:

      Thanks. Yes I agree with you.. and in fact even the list of last 10 closed tabs have been mentioned in the blog post 🙂

      But as I have seen many power users, who tend to open and close many many tabs as they browse.. sometimes it comes to a point where they have closed almost 10-20 tabs after the one you are trying to reopen. At that time, its practically time consuming if I have to undo closed tab continuously right. I hope that makes sense 🙂

  2. Amal Roy says:

    Thanks Bro for this wonderful hack! Very Useful for a clean person like me too.

  3. Nihar says:

    Thanks for the wonderful post..

  4. Hakeem - technology and gadgets says:

    Before I always lost all the tabs that I need when I close the firefox.

  5. Dahab Offers says:

    fire fox full of secrets and it can be developed often by many people

    i like it more than any browser

  6. AliBaba Hotel Dahab says:

    thanks for the idea

    but fire fox now when its crush it come back and ask if i need restore the previous session

  7. s60v5 apps says:

    awaesome tip

1 Pings / Trackbacks.

  1. says:

    Backspace als “Zurück”-Taste im Firefox unter Ubuntu…

    Firefox Screenshot -about:config Wer den Mozilla Firefox unter Windows benutzt hat dort bereits standardmäßig die Backspace-Taste als Shortcut mit der Zurück-Schaltfläche des Browsers verknüpft. Im Prinzip so, wie es im Internet Explorer auch ist. Unte…

Leave a Reply

Your email address will not be published. Required fields are marked *