GreenBear
GreenBear

Reputation: 373

How can I create a "Restore Previous Session" button on my custom HTML Homepage?

about:home in Mozilla Firefox opens an HTML page, that has a "Restore Previous Session" button.
Upon clicking that button a previous session is restored.
I am creating my custom HTML homepage and want to put there such a button.
How can I achieve that?
I found this code, but it does not work in HTML, I suspect it works only in XUL.

function RestoreSession(){
  var Cc = Components.classes;
  var Ci = Components.interfaces;
  var ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
  if (ss.canRestoreLastSession) {ss.restoreLastSession();}
};

Also there is a JavaScript code module "AboutHome.jsm" but I do not know if I can use it from an HTML page?

Thank you.

Upvotes: 0

Views: 277

Answers (1)

mdevos
mdevos

Reputation: 15

I am fairly certain that you cannot do this with an external page, and that this is only possible using the pages that are native to the browsers. I belibe that this is built into the code. I may be wrong, but quite certain, so please correct me if I am.

Upvotes: 0

Related Questions