HTML and CSS Reference
In-Depth Information
extensions from URLs, as it is really the underlying MIME header that tells a browser what
it is getting, so it might be quite possible to serve URLs like
http//htmlref.com/ch1/listexamples
rather than
http://htmlref.com/ch1/listexamples.php
Removing extensions will aid in portability and hide implementation details from end users.
N OTE Using a URL rewriting mechanism like Apache's mod_rewrite is the primary weapon in
cleaning URLs.
Fragment Identifier
Besides referencing a file, it may be desirable to send a user directly to a particular point
within the file. Because you can set up named links under traditional HTML and name any
tag using the id attribute from HTML 4 onward, you can provide links directly to different
points within a file. To jump to a particular named link, the URL must include a hash
symbol (#) followed by the link name, which indicates that the value is a fragment identifier.
For example, given <p id="#middle"> found in the file fragmentids.html in the ch1
directory of the topic support site, we would use the URL
http://htmlref.com/ch1/fragmentids.html#middle
Protocol
Finally, we need to specify how to retrieve information from the specified location. This is
indicated in the URL by the protocol value. A protocol is the structured discussion that
computers follow to negotiate resource-specific services. For example, the protocol that
makes the Web possible is the Hypertext Transfer Protocol (HTTP). When you click a
hyperlink in a Web document, your browser uses the HTTP protocol to contact a Web server
and retrieve the appropriate document.
N OTE Although HTTP stands for Hypertext Transfer Protocol, it doesn't specify how a file is
transported from a server to a browser, only how the discussion between the server and browser will
take place to get the file. The actual transport of files usually is the responsibility of a lower-layer
network protocol, such as the Transmission Control Protocol (TCP). On the Internet, the
combination of TCP and IP makes raw communication possible. Although a subtle point, many
Internet professionals are unaware of lower-level protocols below application protocols such as
HTTP, which are part of URLs.
Although less frequently used than HTTP, several other protocols are important to Web
page authors because they are often invoked by hyperlinks. Table D-3 lists some examples.
N OTE Sometimes the protocol javascript: is used in a URL; for example, javascript:alert('hi'). This
is not a network protocol per se, but this form of pseudo-URL to invoke the execution of JavaScript
is commonly found in Web pages.
 
Search WWH ::




Custom Search