[Greasemonkey] GM_xmlHttpRequest and Images

Nikolas Coukouma lists at atrus.org
Sun Mar 19 03:39:52 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Brendan J wrote:
> Okay, I want to make a GM script that uses the GM_xmlhttpRequest to write to
> a file on the users HD.  For instance, every time a page comes up with a
> specific image on it, I want to be able to save that to the HD automatically
> with the GM script.  The image name will probably be the same each time, and
> the specifics of making random names doesn't escape me, but what I'm having
> a hard time doing is, how do I take a image on a webpage and extract its
> little internal binary code into a format JS can manage, and save it to the
> HD?  Is this beyond the scope of JS and GM?
> 
> Thanks,
> 
> Brendan

Right now GM_xmlhttpRequest can only return text because that's what the
Gecko/Firefox API offers. There's lower-level APIs available to extensions.

Greasemonkey does not allow you to read or write files, in general. The
GM_get/setValue is what's available; It's a hash/dictionary structure
that's persisted across pages and Firefox sessions. For persistence,
it's stored in a file, but you can't access it directly from a GM script.

So, yes, you'll need to write an extension to do what you want. You can
still use JavaScript (as GM itself does).

Cheers,
- -Nikolas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEHRjYs2zR4YuWmeERA1Q/AJ4p4wjmsPkdnk86i7n5vZ7gvU504wCeI9g2
ZDUdD+h2GwcT6Z/WBOx/pJA=
=Cd6S
-----END PGP SIGNATURE-----


More information about the Greasemonkey mailing list