Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

How to download a webpage using javascript from firefox ?

  • 2 replies
  • 1 has this problem
  • 1 view
  • Last reply by cor-el

more options

I've been developing an add-on for firefox where I needed to download the webpages that I visit and store it locally. How should I do this ? I've been trying with javascript but there seems to be no proper reference. I googled and found a sample code but this shows error that "Component.classes" is undefined. So can I actually do it with javascript ?

THE LINE IN THE CODE WITH ERROR :

var dir =Components.classes["@mozilla.org/file/local;1"]

      .createInstance(Components.interfaces.nsILocalFile);
I've been developing an add-on for firefox where I needed to download the webpages that I visit and store it locally. How should I do this ? I've been trying with javascript but there seems to be no proper reference. I googled and found a sample code but this shows error that "Component.classes" is undefined. So can I actually do it with javascript ? THE LINE IN THE CODE WITH ERROR : var dir =Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile);

All Replies (2)

more options

Hi, make a folder on your system for each site and go tot the site and Right Click and Save Page as ot give this a try  : http://www.httrack.com/ Note if the site has safe guards up it will not matter what you use and you can not gain access.

more options

You can't use XUL code in a WebExtension, you can only use API calls.

Try to ask advice at the Add-ons forum, that forum is better suited for questions about developing extensions.