Max Jayapaul's Cyberport Computers Page - Article 1

How To Make a Web page and host it free of charge!

Introduction

Designing your home page

Using HTML

Using JavaScript

Finding a home for your pages

Extras

 

Introduction

top

I started out tinkering with web pages in order to learn HTML (which is required in our line of programming) but as my web page evolved, I realized that it would also serve as a vehicle for sharing my ideas and hobbies with other like-minded individuals. It is a enjoyable and creative way of publishing over the net using text, pictures, sounds and movies. The Internet has made a giant leap from the research labs to our homes and offices and personal home pages gives netizens a chance to give a personal touch to technology.

(Basically I got through setting up the web page with a combination of trial and error, tips from the net and help from my friends. There are easier and more efficient ways to make a web page but consider this as a starting point! )

Designing your home page

top

Before actually sitting beside a computer to code, you'll need to have a plan on how your web page is going to look like and behave. It may be just one HTML page showing minimal details like your name, hobbies, contact details or your photo or you can have a central home page from which you can choose a particular page of interest on a site map in a hierarchical manner.

Draw the layout diagram of your web page on paper. An example is given below.

As seen in the diagram, there is a central web page through which all other pages can be accessed. This will help when you're enlarging your web pages and in navigation. This central page will have its file name as index.html. Using the central page as the starting point, you can add hyperlinks in the form of text or pictures that point to other pages specific to your topic of interest.

You must take into consideration the type of browser that your intended audience will use. Write code that can be supported by most common browsers like Internet Explorer and Netscape Navigator. Not all features are wholly supported by one browser.

Try to make your web page as creative, innovative and interesting as as possible by using images, sounds and movies. The Internet wouldn't be an interesting place if it wasn't for the multimedia. But this has a disadvantage too. Image, sound and movie files are very large files and take time to load. This may frustrate the surfers.

Try to make your web page appealing to a wide audience. Don't put in stuff that would hurt anyone's feelings. Remember, there are no physical boundaries in cyberspace.

The best way to learn about designing web pages is by looking at other web pages. The Internet is full of web sites made by professionals and amateurs. You can read the source code on the web page and even copy images, movies and sound files. But first check out their copy-right rules given on the respective pages and check if they allow these files to be put up on other pages.

Once you have a diagram and the look of the web page on paper, its time to look at how to bring it to life by coding.

Using HTML

top

Writing code for a web page may be accomplished in many ways but the most important is HTML (Hyper Text Markup Language). HTML contains a set of tags that format the text in a HTML page in a particular way within a browser. For example, if you want the phrase "Rome wasn't built in a day" to appear bold on the web page, the phrase must be surrounded with <STRONG> tags as shown below.

<STRONG>Rome wasn't built in a day</STRONG>

will appear like this on the browser (depends on your browser settings).

Rome wasn't built in a day

The first <STRONG> tag indicates the starting point of the sentence to be made bold and the last </STRONG> tag indicates the ending point. You can write HTML using notepad (the tags will be invisible and the formats seen only in the web browser) or any simple text editor or use other tools with sophisticated editing capabilities like Microsoft FrontPage, Netscape Composer, Claris Home Page and even Microsoft Word 97!

Here are some pointers in writing HTML code (I won't go into details and this isn't meant to be a HTML tutorial but just a sampling of what you can do with HTML).

An HTML page must begin with the <HTML> tag and end with </HTML> tag as shown in the example below.

<HTML>

Welcome to my web page!

</HTML>

You may add a title to your web page using the <TITLE> tag. This title will appear in the title bar of the browser when it opens your browser as shown in the example below.

<HTML>

<TITLE>My First Web Page</TITLE>

Welcome to my web page!

</HTML>

You can change the style of the text in the web page by changing the font, size or emphasis as shown in the example below.

<FONT SIZE="+2">It makes things look bigger!</FONT>

<U>This is underlined</U>

will appear like this on the browser (depends on your browser settings).

It makes things look bigger!

This is underlined

In the first line, the font size is increased by 2 from the current size (useful if you don't know the default font size of the targeted browser. The second underlines the text.

You can put line breaks using the <BR> tag. This helps in the spacing of text. Note: There is no </BR> tag!

You can add images to your web pages by using the <IMG> tag (I would say that this is most important tag along with the hyper link tag <A> since these two tags gives the functionality that the web is famous for!). The <IMG> tag points to the image file location in the file system. It also contains some extra parameters like height and width of the image when displayed.

<IMG SRC="world.jpg" HEIGHT="200" WIDTH="150">

The above code displays the image file "world.jpg" with a height of 200 pixels and width of 150 pixels. If the picture is not within these dimensions, it is resized to fit the given sizes.

You can add a hyperlink in your page which points to another page using the tag. This way it is easier to navigate from one page to another, hallmark of the web.

<A HREF="world.htm">World Page</A>

The above code will appear like this on the browser (depends on your browser settings).

World Page

For the above code to work, the file "world.html" must be in the same directory as the page containing the hyperlink.

Another image technique is image mapping. In this technique, a large image, like a map, can be divided into polygons (e.g. countries on the map) each pointing to a different web page.

You can make web page interactive by adding text boxes for user input and push buttons using the <INPUT> tag. The tag has additional parameters that specify the type of control being displayed.

Note: For the following code to work in Netscape Navigator, the code should be preceded with the <FORM METHOD="POST"> tag and end with </FORM> tag.

<INPUT TYPE="button" VALUE="Click">

The above code will appear like this on the browser (your browser should support HTML 3.2 or above).

Its good to name the file containing the first page or the home page as index.html. This is because browsers search for index.html if the filename is not mentioned in the URL (Universal Resource Locator - the address of your web page).

Ensure that all the HTML files in the same directory as the index.html. If your directory grows too big then put common web pages under separate folders keeping the directory containing index.html as root. It helps in code maintenance and web updates. Place all image files in a separate folder called "images".

Ensure that the spelling of the files in the web code matched that spelling in the file system. I have noticed that Netscape 4.0+ seemed to be case-insensitve but Internet Explorer 4+ isn't for some odd reason.

HTML is an evolving language. The latest implementation is HTML 4.0. It contains newer tags and features compared to HTML 3.2. But it is not supported by some older browsers. Recommendations on what is to be added to HTML is done by the HTML Working Group at the World Wide Web Consortium (consisting of the top software cos. like Microsoft, Sun, Oracle etc.). Check the Computers Links page for its URL. Not all the tags are supported by all the browsers. For example the <MARQUEE> tag, which allows text to be scrolled across the screen, is supported on IE 4.0 but not on Netscape 4.0. So write your code such that users of both IE and Netscape versions can enjoy your creations. Test your web pages on different browsers like different versions of IE, Netscape or Opera browser.

The user preferences set on the browser will also affect your web pages. For example, if you have used Comic Sans font in your web page, it will appear as the default font (e.g. Times New Roman) on a browser which doesn't have Comic Sans font loaded. Instead of using <BOLD> tag, use the <STRONG> tag since this will cause the browser to use its interpretation of bold fonts. The apparent limitations notwithstanding, many classic work-arounds exist to make the web more exciting and appealing.

One major disadvantage with HTML is the lack of logic and branching instructions like "if...then...else" construct or the "for...next" statement that are common in other mainstream languages. In order to use these constructs, let us look at JavaScript.

Using JavaScript

top

JavaScript is a scripting language and is very similar to Java (It was a joint venture between Sun and Netscape). Its main advantage, other than the extra bells and whistles is that it includes logic and branching statements that HTML lacks. Another advantage of JavaScript over its competitor, VBScript is that JavaScript runs on both Internet Explorer and Netscape Navigator, the most common web browsers. However, JavaScript (or JScript as called by Microsoft) on IE 3 seems to have some problems in supporting some objects so beware! JavaScript treats the web page and the browser window as objects and changes can be made on the objects through defined properties or methods. For example, if you want to display the current browser's type, print the appName property of the navigator object using the write method of the document object as shown in the code below. (Watch out for the capital N in appName. Netscape Navigator is case-sensitive when it comes to JavaScript reserve words!)

document.write(navigator.appName)

It will display the type of web browser that you're currently using (provided your browser supports the above JavaScript objects)

 

Here are some pointers in writing JavaScript code. (This is just to show you what can be done with JavaScript and is not meant to be a tutorial)

Any JavaScript code should begin with <SCRIPT> tag. These tags should be within the </SCRIPT> tags in a HTML document as shown in the example below.

<HTML>

<SCRIPT>

document.bgColor="green"

</SCRIPT>

</HTML>

The above code changes the background color to blue. (I like the current background design, so I'll keep it!)

You can send messages in a dialog box to the users informing them of an event using the alert method.

alert("Warning! Only kids are allowed.")

Click the button to see the above method in action!

You can use logic constructs like "if...then..else" statements in JavaScript to add a level of interactivity to your web page. One important use of the above statement is to check the type of web browser and run a different piece of code depending on the type bypassing inherent incompatibility problems.

<SCRIPT>

var x=navigator.appName

if (x=="Microsoft Internet Explorer") {

document.write("<CENTER><MARQUEE WIDTH=200>You are using Microsoft Internet Explorer!</MARQUEE></CENTER>")

}

else if (x=="Netscape") {

document.write("<CENTER><BLINK>You are using Netscape Navigator!</BLINK></CENTER>")

}

else {

document.write("<CENTER>You are using " + x + " browser!</CENTER>")

}

</SCRIPT>

See the result below. The <MARQUEE> tag is only supported by the Microsoft Internet Explorer and the <BLINK> tag is only supported by Netscape Navigator. The output below depends on whether your current browser is IE or Netscape.

One major issue that you must consider is the incompatibility between JavaScript and JSCript which I encountered while writing this article. This includes unsupported objects and case sensitivity. So make sure you test it on both Microsoft Internet Explorer and Netscape Navigator. (Both are free to download from the 'net)

All the above examples of JavaScript given above come under a programming technique called Client-side Scripting. In this type of scripting, the JavaScript code is embedded into the HTML page and is executed on the client machine i.e. where the browser is running. Server-side scripting technique runs the scripts on the server which then sends the result back to the browser. Examples of server-side scripting are CGI programs usually written in C, C++, Perl etc. (The files are mostly executables or dlls) JavaScripts can be both client-side and server-side. I would prefer client-side scripting since my web pages will be hosted by a free web hosting service that usually would not allow custom built server-side scripts to run on their servers. (Think about viruses, Trojan Horses, Worms etc. and you'll get the idea!) However server-side scripting is much more powerful and should be given serious thought if you are hosting your pages from your machine.

Now that we've fleshed our web page with code, let's look at how to give our web page a cozy home!

Finding a home for your pages

top

For your web page to be seen on the Internet, it has to be hosted on a web server. You may host it on your computer if you have Peer Web Server (Windows 95) or IIS 4 (Windows NT) installed on your machine and running 24 hours a day (if you can afford it). The other choice is to host your web pages on any of the free web hosting services on the 'net like geocities.com (Look at the next section for more free web hosting sites). These web sites give you free space for storing your web pages on their servers which are connected to the Internet 24 days (unless they're down for maintenance!) They also contain web page editing tools with which you can design your pages (These are online tools so expect to spend some time online on the 'net if you want to make a decent web page!) You can then access your web page by an URL (sort of web address). The free space allotted depends on the site: it ranges from 11MB to 45MB (Think about what you want to put. Currently my web pages take not more than 1 MB! These sites also give freebies like hit counters (displays no. of visits to your home page), headline tickers (streams daily news headings across your screen) etc. (Note: These are server-side scripts)

Here are some pointers in choosing a web hosting service (The pointers below are based on my experience with geocities.com but can be applied to other web hosting services as well).

Instead of using the web editing tool supplied by the web hosting service, you can use any text editor and "hand code" your web site using pointers shown in the preceding sections. This will give you a flexible approach to your web page development and you can upload your completer web files using FTP (File Transfer Protocol) or the web hosting services' File Manager.

Most of these free web hosting services run on advertisements. Every time you open your web page, a pop-up window opens showing ads. To prevent this irritating pop-ups, you may choose to add these ads as part of your web page by using minimal code that the web hosting service will provide. (However you cannot disable them!) Some sites like XOOM.com displays your web pages in a frame layout with their ads taking the topmost frame.

Most of the web hosting services give freebies. Read through the offerings and add them to your web-sites. Most of them require minimal or no coding to attach them to your web page. For example Geocities gives a bland counter that only records the number of visits made on your web-sites but XOOM on the other hands gives a tool which not only lists the number of hits but also the visitor's IP Address, the country where they are based, the statistics of the hits like no. of hits per week etc! (Geocities also has a similar tool but you have to pay for it!)

The web hosting services usually have web servers running on UNIX or Linux. There may be problems with regard to the naming convention of the files being uploaded especially if you have created the HTML files in Windows. Avoid using any hyphens, underscores, spaces or special characters while naming files. Use the .html extension instead of the .htm extension for HTML files (UNIX and Linux are more common the NT servers!)

If you've come this far then you shouldn't have any problems hosting your own web pages. Visit the links below if you want more details or contact me. Happy web paging!

Extras

top

Get more details on the above sections from MacMillan Press books at www.mcp.com. They have books in different sections like Web Design, HTML programming and server-side programming. You can create your own personal bookshelf.

Many web hosting services give URLs that are long and cumbersome like www.geocities.com/SiliconValley/Code/8173. You can use web redirection facilities like DHS and get a URL like max-jayapaul.n3.net!

For more details on HTML, get it straight from its creators at World Wide Web Consortium.

For details and tutorials on JavaScript, get it straight from the horses' mouth at Netscape's JavaScript Page.

Last updated on 1 January 2000

1