I’m trying to make an extension that opens the downloads manager window as a sidebar or some other way, and not a new window.
-
For this, I must first stop the “Save” button, in the “Save Dialog”, from opening the downloads manager as a new window.
-
And then, I must set the
oncommandattribute of the button to my custom function.
What I think, could be done : (Please see the edit, instead of this)
(If I have the id of the “Save” button in the “Save dialog”, I could
removeAttribute("oncommand") and then setAttribute("oncommand", "some_other_function");
Though, I am extremely unclear about whether the updated attribute will last. If the Save dialog is opened by a openDialog call (INTERNALLY), a new one would appear every time.
- Is this the right way of doing it? What then, is the id of the “Save” button? (Also, how can I know when the “Save dialog” is opened? That is when the save button would have any meaning.)
- How else could it be done?)
EDIT :
I think it would be possible via XPCOM interfaces. Is there someway by which I can :
- Know when a download/save is initiated?
- Get access to the Save dialog that opens after the above?
1 – I could tell when a download started using the nsiDownloadService XPCOM interface.
dl-startwas the required topic id.(I could not find where
dl-startis documented in MDN. Could someone point it out, please?)2 – I just had to set the preference
browser.download.manager.showWhenStartingtofalseto stop Firefox from opening it’s own Download Manager in a new window.