Register for EarthWeb's Million Dollar Sweepstakes!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

HTML 4.0 Sourcebook
(Publisher: John Wiley & Sons, Inc.)
Author(s): Ian S. Graham
ISBN: 0471257249
Publication Date: 04/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


About URLs

About URLs reference general information about the browser. This URL format was invented by Netscape as a tool for displaying information about the browser and also for presenting personal information about the browser developers. For example, the URL about:mozilla references (only on Netscape Navigator) a brief page that reflects the youthful enthusiasm of the Netscape developers (just try it!), while the URLs about:marca and about:ebina provide information about Marc Andreessen and Eric Bina, two of the co-founders of Netscape Inc. Needless to say, these three URLs do not work on Internet Explorer!

There are, however, four about URLs with practical uses. These are:

about: (Netscape Navigator only)Provides some practical information about the browser, such as the version number, or the list of software packages licensed, by Netscape, for use within the browser. This is equivalent to the “Help...About” menu item.
about:blank (Netscape Navigator and Internet Explorer)Requests that the browser render a blank page, using the browser’s default background color. This is useful for creating a blank window or a blank frame within a FRAME document. The latter can be accomplished, for example, via FRAME elements of the form:
<FRAME SRC=“about:blank” NAME=“frame-name”>

<FRAME SRC=“about:”      NAME=“frame-name”>
The above elements are identical and simply illustrate the two ways in which about can create a blank frame.
About:cache (Netscape Navigator only)Requests that the browser list the files stored in the browser cache. Note that for large cache sizes, this can cause the computer (in particular, Windows 95 or Macintosh machines) to “freeze” for several minutes as the cache is processed.
About:plugins (Netscape Navigator only)Requests that the browser list all the plugins installed on the Web browser. This lists the MIME types, the name of the company providing each plugin, and the typical filename suffixes associated with the MIME type.

Javascript URLs

Javascript URLs encode JavaScript program code within a URL. The general form is

javascript: javascript-statements

where javascript-statements is a semicolon-separated list of valid JavaScript statements. This URL can, on Netscape Navigator and Internet Explorer 4 (but not Internet Explorer 3), be typed directly into the “Open File” or “Location” window, thereby providing an easy way to test simple JavaScript expressions. For example, typing the URL

javascript:alert('Hi Mom!')

into the browser’s “Location” window will tell the browser to pop up a JavaScript alert window with the associated text.

With Netscape Navigator, the special URL javascript:—that is, a javascript URL without any JavaScript statements—causes the browser to display a special JavaScript type-in field at the bottom of the browser window. This is useful for testing small pieces of JavaScript code. The results of running the typed-in JavaScript commands are displayed in the portion of the browser window above the type-in field.

Javascript URLs can be used, within a hypertext anchor, to invoke a JavaScript program when the hypertext link is accessed. Example markup is:

<A HREF=“javascript:anchor_handler()”>anchored text</a>

where the function anchor_handler() is a JavaScript function to run when the link is accessed. Similarly, the SRC element of an IMG element can take a javascript URL value, but note that the script must then pass an image to the IMG element object so that the element has something to display.

Of course, using javascript URLs in these contexts means that the documents will be improperly rendered—or will not function at all—if JavaScript is disabled or is not supported by the browser. A more reasonable approach is to use the onClick (or other) event-handling attributes for the A and IMG elements, as discussed in Chapter 7.


NOTE JavaScript URLs Not Fully Supported in Internet Explorer 3

Internet Explorer 3 does not support JavaScript URLs that are typed directly into the Location window of the browser. However, the browser does support JavaScript URLs that are present as values of hypertext anchor HREF attributes.


Mailbox URLs (Netscape Navigator 4 Only)

Mailbox URLs reference the local mail client on the browser. With Netscape Navigator 4, a mailbox URL causes the browser to launch the mail client (usually Netscape Messenger) and open the mailbox defined in the body of the URL. For example, the URL

mailbox:inbox

will open the folder named “Inbox,” which, with Netscape Messenger, is the default name for the folder containing incoming, unread mail. If no folder is specified (i.e., mailbox:), then the mail client is launched, and the user must choose a mailbox to open. If the URL specifies a mailbox that does not exist, then the mail client is not launched. Netscape Navigator 4 also uses mailbox URLs to display, on the Navigator browser, resources that are referenced within mail or newsgroup messages via cid or mid URLs.

Res URLs (Internet Explorer 4 Only)

Res URLs reference a resource that can be retrieved from a software module, or DLL (Dynamic Load Library), accessible to the browser. The general form is:

res:// resource-file/res-type/res-id

where resource-file/ is the path to and name of the file containing the module, res-type/ is an optional string that defines the resource type, and res-id is the specific identifier for the resource within the module. An example is:

res://mymodule.dll/doc23.html

The use of res URLs requires a detailed understanding of the Active-X model for data storage within DLLs. For those interested, this information is available at the Microsoft Web site, at:

www.microsoft.com/msdn/sdk/inetsdk/help/itt/protocols/protocols.html

View-Source URLs (Netscape Navigator 4 Only)

View-source URLs cause a Netscape browser to render a source listing of the referenced resource. The value for the view-source URL must be the URL of the resource to be displayed, for example:

view-source:<http://www.utoronto.ca/home.html>

View-source URLs are used internally by the Netscape Navigator software to generate source listings and should not be used in HTML documents.

Wysiwyg URLs (Netscape Navigator 4 Only)

Wysiwyg URLs are used internally by Netscape Navigator’s JavaScript engine and denote certain cases where JavaScript code produces the document content being displayed by the browser. Authors should never themselves code (or need to code) wysiwyg URLs—but it is always nice to know where they came from!

Coming Attractions

Several other special-purpose URL schemes have recently been defined and are being deployed in a variety of applications. For example, the imap scheme designates IMAP mail servers, mailboxes, messages, and search programs on Internet hosts, and is used to locate mail messages on IMAP servers. This serves as a useful complement to the cid and mid URLs.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.