Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.sao.ru/cats/~satr/JS/REF/tags17.htm
Дата изменения: Wed Jan 28 07:31:00 1998
Дата индексирования: Tue Oct 2 05:32:36 2012
Кодировка:

Поисковые слова: п п п п п п п п п п п п п п п п п п п
HTML Tag Reference [Contents] [Previous] [Next] [Alphabetical Tag List] [Index]

HTML Tag Reference

URLS

You can specify URLs (uniform resource locators) that do the following tasks:

The file links.htm has working examles of several kinds of URLs.

Opening a Document in a Web Browser

To open a document in your browser, use a URL that specifies an absolute or relative location for the document. An absolute location has the form:

http://domain-name/pathname
For example:

http://www.netscape.com/comprod/index.html
A relative location can either be relative to the root path for the current document, in which case it begins with /, for example:

/comprod/index.htm
or relative to the directory containing the current document, for example:

images/image1.gif.

Opening a Local File

To open a local file in your web browser, use a URL that has the form:

file://directory/filename
For example:

file://rootdir/documents/htmlref/tags.htm
Use the file URL to examine local documents only; do not use it in documents that will be served by web servers.

Invoking JavaScript

You can invoke JavaScript by using a URL that has the form:

javascript:javascriptCode
For example:

<P>If you click on this link, you'll see a 
<A HREF="javascript:checkBeforeProceeding();">
confirmation dialog box.</A>

Opening a Mail Message Window

A URL that opens a mail message has the form:

mailto:address
For example:

mailto:support@somecompany.com
Netscape Navigator 2.0 introduced an extension to the mailto URL so it can initialize the contents of a mail composition window. You can provide default values for header fields in the mail message. Each field name must be separated by &. For example, the following mailto URL opens a mail message addressed to support@somecompany.com. The subject field has the value "help needed", and the cc field has the value "carbon@somecompany.com."

mailto:support@somecompany.com?subject=help needed?cc=carbon@somecompany.com
If the URL is used in a link, any header fields that do not correspond exactly to headers you can edit in a mail composition window are ignored. However, if it is used as the POST address of a form submission, all headers are generated, even unknown ones, except for "dangerous" headers. The headers that form submissions cannot set or override the default values are:

Netscape Navigator 4.0 added a further extension so that you can also specify the body of the message by supplying a body field, for example:

mailto:support@somecompany.com?subject=help needed?
cc=carbon@somecompany.com?body=I need some help with version 3.15798 of the ABC software product.
New lines in the body must be hex encoded. For example, use %0A to indicate new lines.

Not all browsers understand mailto URLs.

Connecting to an FTP Server

A URL that connects to an FTP server has the form:

ftp://ftpdomain/
For example:

ftp://ftp.netscape.com/

Reading a News Group

A URL that reads a newsgroup has the form:

news:newserver
For example:

news:alt.rec.recipes

Connecting to a Gopher Server

A URL that connects to a gopher service has the form:

gopher://gopher.somehost.com

Invoking a CGI Program

You can use URLs to invoke CGI programs. A CGI program runs on a a server, processes arguments sent by the URL, and returns data to the browser. It is beyond the scope of this reference to provide details of CGI programming, but many fine books are available on the subject, and also lots of information is available on the web. A good starting point is:

http://hoohoo.ncsa.uiuc.edu:80/cgi/overview.html

To specify a URL that invokes a CGI program, specify the location of the CGI program, followed by a query string which contains the arguments for the program. A query string consists of a question mark, followed by the name/value pairs to be submitted to the program. Each name/value pair is separated by an &. Use the URL-encoded value %20 to indicate white spaces and %0A to indicate new lines.

The following example invokes the program "compute.cgi" that takes three arguments. The value of the argument val1 is 25, val2 is 39, and text is "how now brown cow".

http://www.somecompany.com/
cgi-bin/compute.cgi?val1=25&val2=39&text=how%20now%20brown%20%cow
Note that in the above example there should be no line breaks; the line break shown is for readability only.

URLs for CGI programs can be absolute or relative, as discussed in Opening a Document in a Web Browser.


[Contents] [Previous] [Next] [Alphabetical Tag List] [Index]

Last Updated: 01/26/98 21:33:44


Copyright © 1998 Netscape Communications Corporation