In Gecko 1.9, the findbar widget moved into toolkit, so it's available to any XUL application, as well as extensions.
For example, the standard findbar in Firefox 3.5 looks like this on the Mac:
You may attach a findbar to a particular browser element by either setting the findbar's browserid attribute to the ID of the browser element before the findbar element is bound, or by setting the findbar's browser property to the browser element itself.
- Attributes
- browserid, findnextaccesskey, findpreviousaccesskey, highlightaccesskey, matchcaseaccesskey
- Properties
- browser, findMode
- Methods
- close, onFindAgainCommand, open, startFind, toggleHighlight
Example
<browser type="content-primary" flex="1" id="content" src="about:blank"/> <findbar id="FindToolbar" browserid="content"/>
Attributes
findnextaccesskey
- Type: string
- The access key for the "Find Next" toolbar button in the
findbar
.
-
findpreviousaccesskey
- Type: string
- The access key for the "Find Previous" toolbar button in the
findbar
.
-
highlightaccesskey
- Type: string
- The access key for the "Highlight" toolbar button in the
findbar
.
-
matchcaseaccesskey
- Type: string
- The access key for the "Match case" checkbox in the
findbar
.
Properties
Inherited Properties |
-
findMode
- Type: integer
- Read only. The find mode in use. Possible values are:
FIND_NORMAL
(0): Normal findFIND_TYPEAHEAD
(1): Typeahead findFIND_LINKS
(2): Link find
Methods
close()
- Return type: no return value
- Closes the notification or findbar and removes it from its enclosing
notificationbox
orfindbar
.
open( mode )
- Return type: no return value
- Opens the
findbar
using the specified mode, which should be one ofFIND_NORMAL
,FIND_TYPEAHEAD
, orFIND_LINKS
. If you don't pass a mode, the last-used mode for the same findbar is used. If the findbar hasn't been used before,FIND_NORMAL
is the default.
onFindAgainCommand( findPrevious )
- Return type: no return value
- Call this method to handle your application's "find next" and "find previous" commands. You should specify true as the input parameter to perform a "find previous" operation, or false to perform a "find next."
startFind( mode )
- Return type: no return value
- Call this method to handle your application's "find" command. This opens the
findbar
, focuses the edit field for the search term, and selects its contents. The first time this is called for a given findbar, the findbar will flash to draw attention to itself. The mode should be one ofFIND_NORMAL
,FIND_TYPEAHEAD
, orFIND_LINKS
. If you don't pass a mode, the last-used mode for the same findbar is used. If the findbar hasn't been used before,FIND_NORMAL
is the default.
toggleHighlight( highlight )
- Return type: no return value
- Turns highlighting of text matching the search term on and off; specify
false
to disable highlighting ortrue
to enable it.