X
Tap here to go to the mobile version of the site.

Support Forum

How to download a webpage using javascript from firefox ?

Posted

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);
Quote

Additional System Details

Application

  • User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36

More Information

Pkshadow
  • Top 10 Contributor
819 solutions 10304 answers

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.

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.
Was this helpful to you? 0
Quote
cor-el
  • Top 10 Contributor
  • Moderator
16317 solutions 147250 answers

Helpful Reply

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.

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. *https://discourse.mozilla-community.org/c/add-ons/development *https://developer.mozilla.org/en-US/Add-ons/WebExtensions
Was this helpful to you? 1
Quote
Ask a question

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.