|
Beginner Tip:
Bookmark Those Bookmarklets!
by Larisa Thomason,
Senior Web Analyst,
NetMechanic, Inc.
What if there were tools that let you view your site at different screen sizes, with various background colors and fonts - all without changing a line of your HTML code? What if the tools required no special software, were independent of the Web site - and also were free?
Sound too good to be true? You must not know about bookmarklets.
What Is A Bookmarklet?
Bookmarklets are small, reusable JavaScript routines (255 characters or less) that you can save on your computer in your browser's Bookmark (or Favorites) section (hence the name bookmarklet). When you want to use one on a Web site, you access it via the pull-down menu just as if you were bringing up a favorite Web site. Bookmarklets work on all platforms and there's no special software to download. All you need is a JavaScript-enabled browser.
While most bookmarklets are targeted towards visitors to Web sites, webmasters can use them to help design new Web pages and test changes to existing Web pages without actually changing their HTML code.
How To Find And Use Bookmarklets
Absolutely the best source for bookmarklets is Steve Kangas' site bookmarklets.com. He has collected over 150 scripts you that perform an incredible variety of functions: check how recently a Web page was updated; change the size and/or resolution of your browser window, and more.
We've included one of Steve Kangas' bookmarklets that checks for page freshness. It generates a JavaScript pop-up window that tells you the last time the Web page was updated. Different server configurations may cause the dates to appear incorrectly though; if you get some improbable date like December 31, 1969, that's a server problem, not a malfunctioning bookmarklet.
The steps to save this bookmarklet depend on your system and browser version:
- PC's: save in your Favorites (or Bookmarks) list by clicking your right mouse button and selecting "Add to Favorites" in Explorer or "Add Bookmark" in Netscape.
- Apple/Netscape: Save your bookmarklets in the menu under the Apple icon at the left of the menu bar.
- Put the bookmarklet in your Bookmarks by dragging it from this page to your open Bookmarks window.
- Drag the bookmarklet from the Bookmarks window to your desktop. This will create a bookmark file.
- Drag the bookmark file and drop it in you Apple Menu Items folder in your System folder.
- Apple/Explorer: Use "Command D" - hold down your command key (the one with the apple picture on it) and press the D key - to save the bookmarklet to your Favorites menu.
|
This bookmarklet works in Netscape, Explorer, and the WebTV viewer, but some bookmarklets are browser-specific. You'll get a JavaScript error message if you try to use an Explorer-specific bookmarklet with Netscape - or vice versa. Some bookmarklets may not work correctly in the WebTV browser because it supports a limited version of JavaScript.
Bookmarklets And Framed Pages
You may also get error messages or unusual output if you try to use some bookmarklets on framed pages. A bookmarklet executes in the current window, so if your frameset has several windows, only the parent window is affected. Generally, bookmarklets that work with the content of a page, don't function well in frames (if at all), while bookmarklets that deal with the browser display or resolution work fine in frames.
Efficient Webmaster Tools
Some bookmarklets make it easier to design your Web page:
- Display all 216 browser-safe colors along with their hex code numbers.
- Convert colors from Hex to RGG and back.
- Easily create code for a simple table by entering the number of rows and columns then paste the result into your HTML code.
- Count the number of times a word appears on your page to see if you're over or under-using a particular keyword.
|
Other bookmarklets help you test different color and design options without actually changing your HTML code:
- Highlight every link on your Web page so you can see at a glance what terms you have linked. Note: this script won't actually check your links for accuracy. Use HTML Toolbox link check feature to identify dead links.
- Change page background color. Quickly test different page background colors on your Web page without changing your HTML code.
- Resize window size to approximate different monitor sizes. You can immediately find out if you'll have problems with horizontal scroll bars, graphics, etc.
|
These are all available at bookmarklets.com, but some are browser-specific.
Create Your Own Bookmarklets
Anyone with a little JavaScript knowledge can create bookmarklets. Since their size is limited to 255 characters, bookmarklets are relatively easy to code by hand. Create a simple bookmarklet to test for the Netscape browser by inserting the following text into your browser's Address line:
This script first checks to see if the browser name (appName) is Netscape. If so, it returns an alert box that says "You're running Netscape!" If the appName is not equal to Netscape, then you see the alternate message.
Whether you write your own bookmarklets or download them, consider adding a selection of useful bookmarklets to your list of favorite Web sites. They are handy tools that make Internet surfing more enjoyable and your job as webmaster easier.
|