O'Reilly logo

Firefox Hacks by Nigel McFarlane

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #3. Find Stuff

Search both the Web and the browser environment with Firefox.

This hack explains how to find the stuff you've forgotten, left behind, or yet to discover. It starts with local information in the browser and works its way out to searching the furthest corners of the Web.

Search a Displayed Web Page

You can search the content of a displayed web page. To do so, Firefox provides the Find toolbar. It appears at the bottom of the browser window, above the status bar. Figure 1-5 shows most of the features.

The Find toolbar and associated menu items

Figure 1-5. The Find toolbar and associated menu items

This toolbar is activated by the EditFind or EditFind Again menu options or by the Ctrl-F (Command-F on the Mac), Ctrl-G (Command-G on the Mac), or Shift-F3 hotkeys. Here's a rundown of how it works:

  1. The Find toolbar starts out disabled but gains the focus and the caret in the toolbar text field when you click on it.

  2. Type a string and Firefox automatically begins searching the current page, starting from the page's focused form field, or from the top of the page if no field is selected.

  3. Firefox searches all frames but not all tabs. A security feature terminates searching if the page is too big to search in five seconds.

  4. If nothing is found, the textbox goes red. "Phrase not found" appears, and a sound is issued.

  5. If something is found, you can navigate between items with toolbar arrows or Ctrl-G (Command-G on Mac) and Shift-F3.

  6. You can highlight found items with the Highlight toggle button.

  7. Press Ctrl-F (Command-F on Mac) again and the current search string is selected for replacement. Dismiss the toolbar by clicking the small cross icon located at its right end.

The Find toolbar contains two searches in one. The default search is the one just described, called Find As You Type . It can also be activated with the forward slash (/) key, or if there's nothing focused on the current page and you just start typing. The other kind of search is called Find Links As You Type . It can be activated with the single quote key ('). This alternate search scans only hyperlink text on the page. Use it to find specific links on big pages crowded with links.

Search Web Page Source

You can also search the source code of a web page, something that was never possible in old Netscape browsers. View the page's source by choosing ViewPage Source or with the Ctrl-U (Command-U) hotkey. A new window appears. That window has an Edit menu with the options Find (Ctrl-F or Command-F), Find Again (Ctrl-G or Command-G) and Go to Line (Ctrl-L or Command-L). Choose any of these and a small dialog box appears to control your search. Figure 1-6 shows most of the available features.

Find system for the View Source window

Figure 1-6. Find system for the View Source window

This searching system doesn't use a Find toolbar, but it's similar. It supports full content searching only and doesn't support link searching. It does, however, support case-sensitive searches.

Search Your History

There are several ways to search your surfing history. Figure 1-7 maps out these features.

History searching features

Figure 1-7. History searching features

The most accurate search uses the Back and Forward buttons. Press the small, black down-arrow grippies that sit to the right of these icons. A drop-down list of the web trail for the current window appears. If you ever surfed up a blind alley, then reversed, and went forward in a different direction, the set of blind alley pages is lost from the web trail. Full URLs, form data, and scrolled position are all otherwise preserved.

For another way to search, try the Go menu. It shows the most recently viewed URLs across all windows' session history . Only remote web pages are shown. Form posts and page scroll positions aren't preserved. As you view more pages, older items are pushed off this menu. To increase the size of the session history, modify this preference [Hack #23] :

browser.session_history.max_entries /* 50 is default */

The History sidebar, displayed with ViewSidebarHistory (Ctrl-H or Command-H), provides the broadest search. It records your global history (all the web pages examined in the last nine days). It searches the titles of those pages only—no title content, no match. Delete the search string to see the day-wise hierarchy of pages again. Hack these preferences to change the defaults:

browser.history_expire_days /* 9 is the default */
browser.history.grouping    /* "none", "day" or "site" */

Finally, the Location bar can be used to search recently visited web sites in your global history. Type any string into the location bar and suggested domain name matches automatically appear in a drop-down list below the text box. This is called auto-complete. You can't search for path-specific bits of a URL until you've got the whole domain name (e.g., http://www.yahoo.com) right.

Search Your Bookmarks

Are you overflowing with bookmarks and can't remember any of them? Open the Bookmark Manager using BookmarksManage Bookmarks... and type something into the search window. This search examines the full URLs of all bookmarks and their descriptions. The descriptions usually match web page titles, unless you changed the titles when storing the bookmarks. You can also sort the Bookmark Manager's view of your bookmarks from the View menu, which might be helpful. It's almost a depth-first tree sort, though, which is a sophisticated sort. It takes a bit of getting used to. Try it.

Search for Lost Logins

Typed your username and password into a web site and then forgot what they were? Firefox can help. Choose ToolsOptions to bring up the Options dialog box. On Unix/Linux, it's under EditPreferences. On Macintosh it's under Options in the Application menu. Click the Privacy icon. Note the Saved Form Information and Saved Passwords items. Click each one's expando (the small plus icon) in turn. Turn on the various options by clicking their corresponding checkboxes, as shown in Figure 1-8.

Options preferences for form and password tracking

Figure 1-8. Options preferences for form and password tracking

Visit a web page with a form containing at least one text box, fill it in, and submit. Google's home page (http://www.google.com) is a good choice. Open a new Firefox window. Visit the page again. Left-click on the textbox twice. A drop-down menu appears, showing you the value you just typed. Pick the one you want.

Alternatively, visit a web page requiring a login. I log in at http://bugzilla.mozilla.org a lot (follow the login link). Use Firefox's form completion to enter your username, and Password Manager automatically adds the password. Just click the Login button and you're in.

Later on, you can review what you've saved. Back in the Options dialog box, under PrivacySaved Passwords, click the View Saved Passwords button. In the resulting dialog box, click Show Passwords and Yes. Your passwords appear in plain text as an additional table column. Found them!

Search the Web

The Navigation toolbar includes a Search field on the extreme right. It uses the Google search engine by default. Type a keyword into the field and press Enter. Google replaces the current page with its search results. Alternatively, click on the small Google icon to see the other search engines installed by default; you can use any of them as well. Empty the Search field again and type a common letter, such as a. The Search box drops down a list of keywords starting with a that you've typed before.

Search for Firefox Preferences

Firefox has lots of preferences. Type in the URL about:config to see many (but not all) of them. There are too many to understand all at once. Type anything into the textbox labeled Filter: to restrict the list to the ones you care about (try typing go). The set of preferences is marginally different between Linux and Windows, but 99 percent of Firefox preferences apply to all platforms.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required