Category:Example code
From MozillaZine Knowledge Base
Jump to navigationJump to search
- Up to Development
Articles in this category demonstrate the code to do certain things in Mozilla-based products (at this moment, mostly for use in extensions).
Development documentation is in process of being moved to Mozilla Development Center (MDC). You can find more documentation there.
XUL
- Creating toolbar buttons (moved to Devmo)
- Adding items to menus using overlays (talks about browser's context menu too)
- Creating a Firefox sidebar
- Creating dialog windows with XUL
- Dynamically modifying XUL-based user interface. Talks about using DOM API to add, move, and delete widgets from UI at runtime.
JavaScript
Commonly used techniques
XPCOM
- Performing file IO
- Using observers for cross-window notifications
- Running applications
- Using nsIFilePicker] (Open, Save, Select Directory dialogs)
- nsIWindowMediator - enumerating existing windows.
- nsIPromptService (privileged version of alert(), confirm(), prompt() plus their extended versions): some examples, forum thread.
- Working with protocols:
- Dev : Extending the Chrome Protocol
- Adding a New Protocol to Mozilla by Doron Rosenberg.
- Using nsIURIContentListener to listen for specific MIME types, e.g., application/x-bittorrent
- Implementing XPCOM components in JavaScript
- Using progress listeners
- Executing your code each time a page loads
- Enumerating tabbrowser tabs
- Reusing tabs for the same URL
- detecting tab selection, addition, removal
- Open_page_using_tab_settings
XML Technologies in Mozilla
Moved here (MDC)
Other
- Working with windows in chrome code article on Devmo. Discusses various development tasks involving working with windows.
- Opening a new browser window
- Inserting text at cursor
- Creating a XUL mailto: link
- Automatically deleting files when the user uninstalls your extension
- Adding Drag and Drop to Statusbarpanel
- Creating sidebar extension
- Sorting Trees
- Encoding strings
- Getting Current URL
- Using events to pass messages from content to chrome
- Using the scrollwheel
Techniques
- Differential inheritance in JavaScript using
__proto__
- Increasing security with XPCNativeWrapper
The alphabetical list of all articles and subcategories in this category follows.
Pages in category "Example code"
The following 8 pages are in this category, out of 8 total.