Sunday, November 23, 2008

Creating FireFoxe Extension

Creating FireFox plugin is not too much tricky task .In last few days I need to develop firefox simple extension. I found it easy and all help available in mozilla firefox web site http://kb.mozillazine.org/Getting_started_with_extension_development and some best tutorials are also available.

You can found all basic steps in above link and some of my findings are below

1) Menu ,Menu Items and Tools bars can be added using xul controls but some times we need to add menu-items in existing firefox menus for example file-->My Hello World Menu-Item

You need to understand browser.xul file for this case which is located under $Mozilla-Home/lib/browser.jar/content/browser

For example we need to add menu-item under file menu which id in browser.xul file is id="menu_FilePopup"

So write in plug-in xul file
<menupopup id="menu_FilePopup">
<menuitem id="helloworld-hello" label="&helloworld; nsertafter="menu_saveFrame"
oncommand="HelloWorld.onMenuItemCommand(event);"/>
</menupopup>

Note: menu_saveFrame is id save menu-item under file menu
In same way you can add any of button , image in popup menu ,tool bare and so on ...

2) Second I need to get current content url or current tab url with in plug-in's javascript files which can be get by using window.content.document.location not by window.location

No comments: