Wednesday 13 May 2015

Diving into the HTML Format

 Many first-time users think that HTML files are actually programs that run within the browser. This could not be further from the truth. An HTML file is simply a text file containing a number of special codes (known as tags). These tags are used by browsers to display text, graphics, multimedia, and you guessed it, applets on the browser screen.

Note
Because of the way HTML was designed, it is becoming more common to find fantastic Web pages created by desktop publishing gurus and artists than it is to find good pages created by software developers. (As a Java developer, however, you will be able to add a whole new level of interactivity that the less technically minded will find impossible to duplicate!)
All of this would have been a fantastic technology had the Web creators stopped there…but they didn't. They also allowed "links" to other locations to be included as normal text, graphics, and so on. These locations are collectively known as Uniform Resource Locators (URLs). The format for designating a URL is the following:
URLType://Internet Node/File Path/File?Arguments
Some sample URLs include:
http://www.tasc.com (My company's home page)

ftp://ftp.sun.com (Sun's ftp site used to transfer files to your machine. 
The JDK can be obtained here as well as from a Sun web page). 
news://comp.lang.java (the Java language newsgroup.
An absolute must-visit for serious Java developers!)
The following types of URLs currently recognized include:
  • http-HyperText Transport Protocol.
  • https-Secure version of HTTP.
  • file-Used to access files on the user's local drive.
  • ftp-File Transfer Protocol. FTP is used to transfer files to and from computers that can act as FTP servers.
  • mailto-Used to generate an e-mail form. This is a non-standard URL that is supported by most Web browsers.
  • news-USENET news group.
  • wais-Wide Area Information Server.
  • gopher-Gopher is a method used to search the Internet for file information. This search method has fallen out of favor due to the vast amount of information stored at Web sites such as Yahoo! (http://www.yahoo.com) and AltaVista (http://altavista.digital.com).
  • telnet-Opens a telnet session at a remote computer.

Listing 12.1 shows the contents of the HTML file that makes up the text-only (http://www.sun.com/960601/index.textonly.html) home page of Sun Microsystems (in June 1996). There is also a graphical home page and, of course, a Java version as well.

Listing 12.1. Contents of the Sun Microsystems home page.
<HTML>
<HEAD>
<TITLE>Sun Microsystems</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<!-- HEAD_END -->
<H2>Sun Microsystems<br>
    June 1996</H2>
<P>
<ul>
<font size=+2><strong>Scott says... <A HREF="/960601/cover/">
Âkick butt and have FUN"</a></strong></font><br><em>Sun's feisty
ÂCEO Scott McNealy discusses Java, the Internet, his son Maverick,
Âand more...</em>
<p>
<font size=+1><strong>Rapid, Reliable <A HREF="/960601/feature1/">
ÂWeb Services</a></strong></font>
<p>
<font size=+1><strong>Sun's <A HREF="/960601/feature2/">Intranet</a>
ÂBoosts Productivity</strong></font>
<p>
<font size=+1><strong><A HREF="/960601/feature3/">Infoseek</a>
ÂSpiders Index the Web</strong></font>

</ul>
<UL>
<ul>
<LI><h3>Check out <A HREF="/960416/pbs_facts.html">&quot;Life on the
ÂInternet&quot; </A><br><strong> A 13-week PBS series underwritten
Âby Sun.</strong></h3>
<LI><h3>Visit <A HREF=/sunworldonline/index.html>SunWorld Online
Â</A> magazine - it's hot!</h3>
<LI><h3> <A HREF=whatshappening.html>What's New!</A></h3>
<LI><h3> <A HREF="/sunsoft/Developer-products/java">Develop Web
ÂApplications that Sizzle !</A></h3>
</ul>
</ul>
<HR>
<ul>
<h3><A HREF="/products-n-solutions/index.html">Products and Solutions</A></h3>
<h3><A HREF="/sales-n-service/index.html">Sales and Service</A></h3>
<h3><A HREF="/tech/index.html">Technology and Developers</A></h3>
<h3><A HREF="/corporateoverview/corp.html">Corporate Overview</A></h3>
</ul>
<HR>
<ul>
<h3><A HREF="/sun-on-net/index.html">Sun on the Net</A></h3>
<h3><A HREF="/search/search.html">Search</A></h3>
<h3><A HREF="/backissues.html">Back Issues</A></h3>
</ul>
<HR>

A version of this page with nice <A HREF="index.html">graphics</A> is available.
<P>

<!-- FOOT_START -->
<HR>
<FONT SIZE=2> Questions or comments regarding this service?
<A HREF="/cgi-bin/comment-form.pl"><EM>webmaster@sun.com</EM></A>
</FONT>
<P>
<H5><A HREF="/share/text/SMIcopyright.html">Copyright</A> 1996
ÂSun Microsystems, Inc., 2550 Garcia Ave., Mtn. View, Ca 94043-1100 USA.
ÂAll Rights Reserved
</H5>
</BODY></HTML>

This file is included on the companion CD-ROM to this book as index_textonly.html. If the pages still exist on the Web servers that this document points to, the document should be able to be loaded at any point in the future and still allow the reader to connect to any of its links. You can see, therefore, that the content of HTML pages is independent of where these pages reside.
The remainder of this chapter will focus on two topics:

  • Embedding Java applets within HTML pages
  • HTML document creation

No comments:

Post a Comment