0

How to save images from web pages to local disk, using Chickenfoot Firefox extension?

writeBytes(filename: string or nsIFile, data: string)

the function is provided by Chickenfoot to Writes data to the given file, completely replacing the file's contents on disk. Only the lower byte of each character in the data string is saved in the file, so only use this command for saving 8-bit binary data, like images or binary files. For textual Unicode data, use write() instead.

But the problem is that I don't know how to get images from webpages using javascript.

Thanks in advance.

1 Answers1

1

one possible solution i have used just now is using

var saveFileTo = "/images/"+name+".jpg";
writeBytes( saveFileTo, read(image_url_location) );

if you want to get every image in a html document, you can use

var images = document.images;
  var image_url_location = images[0].src;

But unfortunately the problem with writebyte is it isn't opening. maybe it's some header issue.. mimetypes.. etc.