Hack 80. Make a Toolbar That Can't Be Hidden![]() ![]() web page can remove.You might not like HTML window pop ups, but sometimes there's no choice but to put up with them. Banking sites are a common example. When a pop-up window is stripped of all browser toolbars, it takes away more user control than technical people are comfortable with. This hack shows how to put in a toolbar that can't be taken away. It's a very quick-and-dirty hack. 7.7.1. Adding a Permanent ToolbarTo make this change, we'll modify the browser.jar chrome archive in the install area.
in a temporary directory. Edit the browser.xul file with a text editor. Find the <toolbox> tag; that's the tag that holds the menu bars and toolbars at the top of the browser window. That tag's first child is a <toolbar> tag. Ignore that tag; it holds the menu bar. After that tag's closing tag, add this content: <toolbar>That's all. Zip the contents back up into a new browser.jar. It doesn't matter if archive size and file order within the archive change. Move the official browser.jar aside, and put this one in its place. If the browser starts up, then there are no syntax errors. If you can see the toolbar, as shown in Figure 7-7, then everything's working. Figure 7-7. Firefox window with extra toolbar hacked in![]() 7.7.2. Testing the New ToolbarHere's a simple HTML document to test the toolbar: <html>Figure 7-8 shows the results with a trivial testl page. Figure 7-8. The pop-up window with toolbar and status bar enforced![]() Firefox always shows the status bar. You can change that by unsetting this preference: dom.disable_window_open_feature.status /* default = true */ 7.7.3. Decorating the New ToolbarYou can put anything you like in the new toolbar. The following widgets open a new browser window, a window with a given URL, and a text field in which JavaScript statements can be evaluated: <toolbar>Figure 7-9 shows the result. Figure 7-9. The pop-up window with improved custom toolbar![]() will be displayed when you press Tab. Type any JavaScript expression into the Eval field, and the code will be executed when you press Tab. |