views:

193

answers:

2

I've read some documentation and tutorials about developing Firefox Addons. But never found how to do this.

I would like to make an addon that when you try to save a file (via left-click or right-click/save as) it automatically sets the to-be-created-file's name to be the same as the original file's URI. (but with some changes, like making slashes into hyphens, etc.)

Any hints on how to do this? Thanks!

A: 

I don't believe Firefox Add-ons can change the default "save as" behavior. They could however add another option in the context menu (right click) perhaps named "save as file named with uri". You'd want to learn some JavaScript and such and look at a demo Add-on for the context menu.

Okay, so I looked at a starting point, which took me to these:

  1. A pretty complete get up an developing guide from Mozilla. (No context menu stuff)
  2. A XUL reference. It mentions there is a way to configure the context menu.
  3. Some code snippets for various Mozilla developing.
  4. A very comprehensive hello-world. Similar to #1, but it DOES cover adding actions in the context menu.
dlamblin
Thanks! that'll work as well. Could you point me to the demo Add-on for the context menu, please?
Petruza
Thanks! and 15 characters more to meet the limit.
Petruza
A: 

I think you can override any behaviour in Firefox - finding out the correct XPCOM call and location in the DOM tree is another matter. Have a look at Extending Firefox and Thunderbird

mikej