I want to be able to save a tab's state in Firefox or Google Chrome so that I can restore it later, through writing a custom add-on/plug-in/extension.
The closest thing I can find is Firefox's session store API, which can save form data and scroll position. However, I want to save Javascript state too. In addition, if possible, I want to be able to restore the page even if the website is no longer available. It would be the best if there a way to save all the parsed resource/data structure.
Is it possible for any of the major browsers?
Just serialize everything you need to restore your page state into a localStorage (it is persistent, unlike sessionStorage) and invoke a respective deserialization function in your page's DOMContentLoaded (or load) event handler.