Chapter 4: Advanced topics ---------------------------------------------------------------------------- Now that you've learned the basics of Web page authoring with Navigator Gold, it's time to let other people on the Internet see what you've accomplished. In this chapter you'll learn how to publish your Web pages and create even more advanced pages using the new scripting language, JavaScript. Publishing your pages Once you have finished creating your Web page, or perhaps an entire Web presentation and tested it on your own system, you can publish it to a server. Right now your page exists on your local disk; you can browse your Web page, but no one else can. When you publish to a server, you're copying your Web pages (HTML files) to a Web server so that others can see what you've done. What is a Web server? A Web server is a program that runs all the time and waits for Web clients (such as Navigator) to connect to it and request data, usually a file. Servers and browsers communicate using the HyperText Transfer Protocol (HTTP), a language created for transferring hypertext documents over the Web. Web servers are often called HTTPD servers. Note: The "D" in HTTPD stands for daemon. A daemon is a UNIX term for a program that sits in the background and waits for requests. You don't have to be on UNIX for a program to behave like a daemon, so Web servers on any platform are still called HTTPD servers, or simply HTTP servers. Finding a Web server Ideally, you'll be able to publish your Web pages using the same organization that gives you access to the Internet. If you get access to the Internet through a commercial provider, that organization might offer Web space that you can use as well. Ask your system administrator if they offer Web server access. Tip: See the Netscape Web Page Starter site for a list of service providers that offer Web publishing accounts. And keep in mind... File names have different conventions and restrictions depending on the platform. It's important to understand these distinctions before publishing your Web information, because you want your documents to be as portable between platforms as possible. If you are working with more than one platform, naming your files is very important. For example, if you're moving your files to or from DOS-based systems, you'll need to follow the 8.3 rule--file names must be only 8 characters long with 3-character extensions. Also, if you're moving files from a Macintosh to other systems, don't use spaces or other funny characters, use only letters and numbers and keep your file names under 8 characters. Using one-button publishing The one-button publishing feature in Navigator Gold makes publishing your Web pages quick and easy. You can select which files or directories you want to upload (publish) to a remote server. You can also specify the remote server site. 1. Choose File|Publish or click the Publish button on the File/Edit toolbar. Publish dialog [Image] If you have specified default publishing preferences in the Editor Preferences dialog, those settings appear in the Publish dialog. 2. Select the "include images in document" option to display all of the image files in the current document (default). Then select any image files you want to publish along with the document. Select the "include all files in document's folder" option to display all of the files (.HTML, .GIF, .JPG) in the current document's directory. Then select the files you want to publish along with the document. This is a quick way to publish an entire Web presentation that is made up of several .HTML files. Note: If a file on the remote server where you're publishing has the same file name as the one you're uploading, it will be replaced with the new one without asking you to confirm the action. 3. Type the location of the remote site you want to publish your Web pages to. You might need to contact your internet service provider to find out what to type here. For example, if your service provider is America Online, the URL in this box might look something like: ftp://ftp.aol.com/docs/yourname/index.html Or, if a Web server protocol is used, the URL might look like this: http://commercialweb.com/docs/yourname/index.html Once you've typed some locations here, in the future you can select from the list of remote locations you've established. Click Use Default Location to have the editor automatically enter the location you've specified in your Editor preferences. 4. Type the name you use when accessing the network where your Web pages will be located. 5. Type the password for your user name. Check Save Password to save your password information so you don't need to retype it each time you publish your Web pages. 6. Click OK. Once the files have been uploaded successfully to the specified server, you can choose Go|Default Publish Location in the browse window to view the page(s) you have just published. Using the File Transfer Protocol (FTP) You can also use FTP to transfer (or upload) your files to a Web server. Navigator Gold lets you access FTP servers in the same way you access Web (HTTP) servers. Note: Most FTP client software lets you choose either ASCII text or binary transfer mode. Although HTML files themselves can be transferred as text files, other files, such as JPEG and GIF files, cannot be correctly transferred that way. In the Navigator Gold browser, files are uploaded to FTP sites in binary mode by default. To point your browser to an FTP site, use the following syntax in the location field: ftp://username@ftp.foo.com/directory1 Tip: For more information about using FTP, see the Netscape Navigator Handbook. You might find the FTP directory and content pages have minimal formatting. When possible, the browse window shows the type, size, date, and a short description of each file in a directory. A directory is presented as a list of links; each link is often preceded by a small icon indicating another directory or a file. Clicking on a directory link displays a subdirectory. Typically, at the top of a subdirectory is a link that displays the parent directory. After you have accessed an FTP server, you can upload files to the site by dragging and dropping them from the Windows File Manager or Explorer to the browse window. This process is easier if all your Web page files are located in one directory on your local disk. Using JavaScript in the editor JavaScript, a Netscape-developed scripting language derived from Java, provides developers with a simplified language to create scripts and small programs. With Navigator Gold, you too can take advantage of the power of this scripting language in your Web pages. JavaScript is a small, property-based scripting language. Scripts written in JavaScript can enhance the features of Web pages, as well as client and server applications. For example, a JavaScript script embedded in HTML can recognize and respond to user-initiated events such as form input and page navigation. Adding JavaScript to your Web pages You can insert JavaScript in the pages you edit with Navigator Gold by applying a special character style to the JavaScript you've typed in your document. For example: Tip: Choose Help|Web Page Starter and go to the Tool Chest for more information about JavaScript. 1. In the editor, type document.write ("

Today is: "+Date ()); 2. Select the text you've just typed and choose Properties|Character|JavaScript (Client). The text color changes to red and displays in a fixed width font. 3. Choose File|Browse Document. If you have not already saved the file, you're prompted to do so. A browse window appears with the following text: Today is: Fri Mar 12 13:05:32 1996 When you view the HTML source, you'll see HTML tags around your JavaScript statements. ----------------------------------------------------------------------------