2

Hi I'm studying Python and I've started my first little project.

The first thing that I want to do is to add an item to the right click menu of Firefox. So, when I right-click a link that item will be available and when I click it some Python code will be called in order to "do something" with that URL.

Do I have to create a Firefox extension to do this? Can I specify in that extension the Python code that should be called?

Wladimir Palant
  • 56,865
  • 12
  • 98
  • 126
mxch
  • 835
  • 2
  • 10
  • 20

2 Answers2

0

I think it is not possible. Normal FF extensions are afaik written in XUL and Javascript and therefore can not call other (non JS-) code.

L3viathan
  • 26,748
  • 2
  • 58
  • 81
0

Yes, you will need to write a Firefox extension. This is a getting-started tutorial. To call your external Python code you will use nsIProcess.

Why have you chosen to do this in Python? Since Firefox extensions do their thinking in JavaScript anyway, if you use that then you don't have to call external processes. In particular, you won't need to install Python for your extension to work!

Katriel
  • 120,462
  • 19
  • 136
  • 170
  • Thanks! I was learning Python and I came up with an idea that would be useful, so my plan was to implement that idea with Python in order to "improve" my skills with this language. However, if it is not necesary I won't use Python for this project and I'll just implement it like a regular Firefox extension. Thank you very much! – mxch Jan 11 '12 at 00:05