Hi,
I'm writing a firefox addon, which could generate some addresses dynamically. So I'd like to invoke flashgot to download them from my addon. Is it possible?
BTW: I want it automatic, not generating a dynamic page and asking user to use flashgot manually.
Thanks,
Kneo
Is it possible to invoke flashgot from another firefox addon
Is it possible to invoke flashgot from another firefox addon
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Re: Is it possible to invoke flashgot from another firefox a
I'm able to get flashgot-service successfully right now. I guess it can be used to start a download. Still investigating...
Code: Select all
{Cc, Ci} = require("chrome")
gFlashGotService = Cc["@maone.net/flashgot-service;1"].getService().wrappedJSObject
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
- Giorgio Maone
- Site Admin
- Posts: 9454
- Joined: Wed Mar 18, 2009 11:22 pm
- Location: Palermo - Italy
- Contact:
Re: Is it possible to invoke flashgot from another firefox a
There's no officially supported API, but something like this should work:
Code: Select all
let flashGotService = Cc["@maone.net/flashgot-service;1"].getService().wrappedJSObject
let links = {
__proto__: Array.prototype, // very important, or use let links=[] and add expandoes later
document: window.content.document, // optional, the document containing the links
referrer: window.content.location.href, // optional, or inferred from document
postData: "param1=something¶m2=something+else", // optional
}
links.push({
href: "http://xyz.com/clip.avi",
description: "Some description", // optional, used by UI
fname: "Forced_file_name.avi", // optional, overrides href URL's file name
postData: "param1=something¶m2=something+else", // optional, overrides links.postData
});
links.push(anotherLinkObject);
flashgotService.download(links);
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Re: Is it possible to invoke flashgot from another firefox a
Many thanks! It's exactly what I wanted to know!
Giorgio Maone wrote:There's no officially supported API, but something like this should work:Code: Select all
let flashGotService = Cc["@maone.net/flashgot-service;1"].getService().wrappedJSObject let links = { __proto__: Array.prototype, // very important, or use let links=[] and add expandoes later document: window.content.document, // optional, the document containing the links referrer: window.content.location.href, // optional, or inferred from document postData: "param1=something¶m2=something+else", // optional } links.push({ href: "http://xyz.com/clip.avi", description: "Some description", // optional, used by UI fname: "Forced_file_name.avi", // optional, overrides href URL's file name postData: "param1=something¶m2=something+else", // optional, overrides links.postData }); links.push(anotherLinkObject); flashgotService.download(links);
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Re: Is it possible to invoke flashgot from another firefox a
For some reason, the '__proto__: Array.prototype' style doesn't work for me, but '[]' does work.
When I use '__proto__: Array.prototype', the external download tool can be launched, but nothing is downloaded.
When I use '__proto__: Array.prototype', the external download tool can be launched, but nothing is downloaded.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
Re: Is it possible to invoke flashgot from another firefox a
I'm able to get flashgot-service successfully right now. I guess it can be used to start a download. Still investigating...
Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36