Red Hat Fedora Linux 3 Bible

Although the Internet has been around since the 1960s, the Web is a relatively new technology (ushered in by the creation of the first Web browser in 1990). The Web places an additional framework over Internet addresses that were once limited to host names and domain names. Before the Web, finding resources on the Internet was difficult. However, the Web now provides several features that make it much easier to access these resources:

The primary tool for displaying HTML Web pages is the Web browser. Mozilla is the most popular Web browser for Fedora Core. Mozilla's Firefox, however, is quickly gaining ground. Both display HTML (Web pages) as well as other types of Web content. Now, even file managers, made for displaying local files and folders, have been extended to be able to display Web content (see the description of Konqueror file manager in Chapter 3).

This section contains general information about the Web and some specific hints for using Mozilla to browse the Web from your Fedora Core system.

Uniform Resource Locators

To visit a site on the Internet, you either type a URL into the location box on your browser or click on a link (either on a Web page or from a menu or button on the browser). Although URLs are commonplace these days — you can find them on everything from business cards to cereal boxes — you may not know how URLs are constructed. The URL form is as follows:

protocol://host-domain/path

The protocol identifies the kind of content that you are requesting. By far, the most common protocol you come across is Hypertext Transfer Protocol (HTTP). HTTP is the protocol used to request Web pages. In addition to HTTP, however, there are other protocols that might appear at the beginning of a Web address. Instead of showing you a Web page, these other types of protocols may display different kinds of information in your browser, or open a completely different application for working with the content.

Table 9-1 lists some of the protocols that can appear in a Web URL.

Table 9-1: Protocols in Web URLs

Protocol Name

Description

http

Hypertext Transfer Protocol. Used to identify HTML Web pages and related content.

file

Identifies a file on a specific host. Most often used to display a file from your local computer.

ftp

File Transfer Protocol. Identifies a location where there are file archives from which you might want to download files.

gopher

Gopher Protocol. Provides databases of text-based documents that are distributed across the Internet. (Gopher is nearly obsolete.)

mailto

Electronic Mail Address. Identifies an e-mail address, such as mailto:joe@example.com. (Usually opens a mail composer.)

news

USENET newsgroup. Identifies a newsgroup, such as news://news.myisp.com/comp.os.linux.networking. If you type this address into Mozilla, a window appears with the newsgroup displayed from the news server you identified

nntp

USENET news using nntp protocol.

telnet

Log in to a remote computer and begin an interactive session. An example of a telnet address is telnet://localhost. (Replace localhost with any host or IP address that allows you to log in.)

wais

Wide Area Information Server protocol. A WAIS address might look like the following: wais://handsonhistory.com/waisdb. (Like gopher, WAIS databases are nearly obsolete.)

The first part of a URL is the protocol. You don’t always have to type the protocol. Most browsers are good at guessing the content you are looking for (mostly it guesses HTTP). If the address you type starts with www, it assumes HTTP; if it starts with ftp, it assumes FTP.

The second part of a URL takes you to the computer that is hosting the Web content. By convention, Web servers begin with www (or sometimes home). However, if you type the correct protocol (usually http), you will be directed to the right service at the host computer. The next piece of this name is just the host.domain style of Internet address that is always used with the Internet (such as redhat.com, linuxtoys.net, or whitehouse.gov). An optional port number can be tacked on to the host.domain name. For example, to request the port used for HTTP services (port 80) from the host called www.linuxtoys.net, you can type http://www.linuxtoys.net:80.

Tip 

You can identify a specific port number to request the service attached to the port on the computer you request. A port number is a lot like a telephone extension in a big company. A main telephone number (like the host.domain name) gets you to a company switchboard. The telephone extension (like the port number) connects you to the right person (like the service associated with a port).

The third part of a URL identifies the location of the content on the host computer. Sections in a Web page can be identified with a pound sign (#) and an identifier following the Web page location. For example, the craft section of the bsched.htm page at handsonhistory.com would appear as:

http://www.handsonhistory.com/bsched.htm#craft

The filename extension (such as .htm or .html) further identifies the content type.

Web pages

If you look at the HTML source code that produces Web pages, you see that it consists of a combination of information and markup tags, all of which are in plain-text format. The idea is to have Web pages be very portable and flexible. You can create a Web page with vi, emacs, gedit, Notepad, or any text editor on any computing platform. Alternatively, simplified frontend programs can be used to provide WYSIWYG (What You See Is What You Get) interfaces that let you see what you are creating as you go.

HTML tags are set apart by right and left angle brackets. Tags come in pairs, with a beginning tag, the information, and then an ending tag. The beginning tag contains the tag name, while an ending tag contains a forward slash (/) and the tag name. Here is a minimal HTML page:

<HTML> <HEAD> <TITLE>Greetings from Wisconsin</TITLE> </HEAD> <BODY> Here we are in beautiful Madison. </BODY> </HTML>

You can see that the document begins and ends with HTML tags (<HTML> and </HTML>). The beginning part of the Web page is contained within the HEAD tags. The body of the page is contained within the BODY tags. The title of the page is set apart by TITLE tags.

Between the beginning and ending BODY tags, you can add all kinds of stuff. You can have different types of bulleted or numbered lists. You can have headings, images, and text. More complex pages can include forms, dynamic HTML (which changes the content as you move or select items), or special data. Figure 9-1 is an example of a Web page as it appears in Mozilla.

Figure 9-1: Many Web pages contain text, images, headings, and links.

Some of the HTML code that was used to create the Web page shown in Figure 9-1 is shown here. The title of the Web page appears between two TITLE tags.

<TITLE>Swan Bay Folk Art Center - American Crafts in Port Republic, NJ</TITLE>

The following code is used to create a link that opens a new mail message window:

A HREF="mailto:webmaster@handsonhistory.com">Contact Us</A>;

The text Contact Us is a link to an e-mail address. When someone clicks that link, a new message window appears, allowing that person to send e-mail to that address.

<FONT FACE="Copperplate Gothic Bold"><A HREF="bsched.htm"> Adult Basketry </A></FONT>

A special font face was used for the words Adult Basketry, with the words pointing to a link to another HTML page. If someone were to click on those words, the bsched.htm page would appear.

Web browsing with Mozilla

During the early 1990s, Netscape Navigator was the most popular Web browser. When it became apparent that Netscape was losing its lead to Microsoft Internet Explorer, the source code for Netscape was released to the world as open-source code.

Mozilla.org was formed to coordinate the development of the new browser from that code. The result was the Mozilla browser that is now available with Fedora Core, as well as with many other computing platforms. The availability on multiple platforms is great, especially if you must switch between Linux and Windows, for example, using Windows at work and Linux at home. Mozilla looks and acts the same on many platforms.

At the center of Mozilla, of course, is the Navigator Web browser. Mozilla also includes the following features:

You can click the Mozilla Web Browser icon directly on the desktop panel to start Mozilla. Or you can open Mozilla from the desktop menu (beginning from the red hat) by selecting Internet ® Mozilla Web Browser. Figure 9-2 shows the Mozilla home page (www.mozilla.org) as displayed by the Mozilla browser.

Figure 9-2: Mozilla is the open-source Web browser based on Netscape source code.

Mozilla has all the basic features you need in a Web browser and a few special features. The following sections describe how to get the most out of your Mozilla Navigator Web browser.

Setting up Mozilla Navigator

There are many things you can do to configure Mozilla to run like a champ. The following sections describe some ways to customize your browsing experience in Mozilla Navigator.

Setting Navigator preferences

You can set your Mozilla Navigator preferences in the Preferences window. To open Mozilla preferences, click Edit ® Preferences. The Preferences window appears, as shown in Figure 9-3.

Figure 9-3: Change settings for navigating the Web from Mozilla’s Preferences window.

The following list shows some Navigator preferences that you might want to change:

The Advanced Preferences can be used to fine-tune your Web browsing experience, as well as specify what content you open can and can’t do on your computer. Here are some Advanced Preferences that might interest you:

Adding helper apps

Although the main type of content provided by Web pages is HTML, many other content types can be displayed, played, or presented by a Web browser. Most additional data encountered by Mozilla is handled in one of two ways: plug-ins or helper apps.

Plug-ins are self-contained programs that allow data to play within the Mozilla window. A helper app can be any program that is available on your Red Hat Linux system. It is up to you to identify the plug-in or helper app to launch when a certain type of data is encountered.

Mozilla determines what helper app or plug-in to launch based on the following criteria:

You can add your own helper app to automatically handle a particular type of data in your browser. Here’s how:

  1. Choose Edit ® Preferences. The Mozilla Preferences window appears.

  2. Select Helper Applications under the Navigator category.

  3. Click New Type. A dialog box appears that enables you to add information about the helper app and the data that it can handle.

  4. Type in a description of the data, the MIME type, and the file suffixes (if any) on files that contain that type of data.

    Note 

    When you add the suffix, don’t include the dot.

  5. Choose an application to handle the data type. If the application needs a Terminal window to run, type xterm -e, followed by the command line you need to enter. This executes the command in an xterm window, reading in data as needed.

  6. Click OK when you are done.

The next time you open data in Mozilla of the type you just added, a pop-up window will ask you if you want to use the application you just entered to open the data.

Adding plug-ins

There are not many plug-ins available for use in the version of Mozilla that comes with Fedora Core. To see a list of plug-ins associated with your Mozilla browser, choose Help ® About Plug-ins. You will probably see one plug-in: MozPlugger. If MozPlugger isn’t installed, you can install it from the DVD that comes with this book. MozPlugger (http://fredrik.hubbe.net/plugger.html) is a multimedia plug-in that handles AVI, SGI-movie, TIFF, DL, IFF-anim, MIDI, Soundtracker, AU, WAV, and Commodore 64 audio files by relying on external programs to play the data. Recently, MozPlugger has also added support for displaying a variety of Microsoft office productivity file types.

Here is a list of some free plug-ins available for Mozilla that work with Fedora Core.

More plug-ins may be added in the future for use with Fedora Core. Mozilla now offers a great new Web site for getting plug-ins for Linux that run in Mozilla: http://plugindoc.mozdev.org/linux.html. The site contains links to download plug-ins and instructions for installing them.

When you download a plug-in, follow the instructions that come with the plug-in for installing it. If the plug-in comes in an RPM file, install it as you would any other software package in Red Hat Linux (rpm -Uvh package command). Otherwise, just copy the plug-in file (a .so file) to the system plug-in directory (probably /usr/lib/mozilla/plugins) or your personal plug-ins directory (probably $HOME/.mozilla/plugins). When you restart Mozilla, the plug-ins will automatically be picked up from those locations.

Note 

The CrossOver Plugin is a commercial product that lets you use many Windows plug-ins in Mozilla. See the section “Adding a CrossOver Plugin” later in this chapter for details.

Using Mozilla Navigator controls

If you have used a Web browser before, the controls are probably as you might expect: location box, forward and back buttons, file and edit menus, and so on. There are a few controls with Mozilla, however, that you might not be used to seeing. Here are some examples:

Improving Mozilla browsing

Every Web site you visit with Mozilla is not going to play well. Some sites don’t follow standards, use unreadable fonts, choose colors that make it hard to see, or demand that you use a particular type of browser to view their content. To improve your browsing experience, there are several things you can add to Mozilla.

Adding a CrossOver Plugin

QuickTime 5 movies, Shockwave Director multimedia content, and various Microsoft movie, file, and data formats simply will not play natively in Mozilla Navigator. Using software built on WINE for Linux on x86-based processors, CodeWeavers (www.codeweavers.com) created the CrossOver Plugin. Although no longer offered as a separate product (you must buy the entire Crossover Office product for $39.95 U.S.), the CrossOver Plugin lets you play some content that you could not otherwise use in Linux. (Download a demo from www.codeweavers.com/site/products/download_trial.)

After you install the CrossOver Plugin, you see a nice Plugin Setup window that lets you selectively install plug-ins for QuickTime 6, Windows Media Player 6.4, Shockwave 8.5, Flash 6, and Microsoft Word, Excel, and PowerPoint viewers. (Support for later versions of these content formats may be available by the time you read this.) You can also install other multimedia plug-ins, as well as a variety of fonts to use with those plug-ins.

Tip 

Although I have had CrossOver Plugin running well in earlier versions of Red Hat Linux, at the time of writing it was not yet working in the current version of Fedora Core. Check with CodeWeavers to see if they have corrected CrossOver Plugin to run in the latest version of Fedora Core.

Adding a Preferences toolbar

Did you ever run into a Web page that required you to use a particular type or version of a browser or had fonts or colors that made a page unreadable? The Mozilla preferences toolbar called PrefBar2 lets you try to spoof Web sites into thinking you are running a different browser. It also lets you choose settings that might improve colors, fonts, and other attributes on difficult-to-read pages.

You can install the neat little toolbar from the Mozdev.org site (prefbar.mozdev.org). Click the Install link; then, after it is installed, restart Mozilla.

Tip 

You must have write permissions to /usr/lib/mozilla-1.7.3 for the Install link to work. This may require you to log in as root, start Mozilla, install the Preferences Toolbar, and then log out as root.

The default set of buttons let you do the following:

The user agent (UA) setting is very useful when dealing with Web sites that require Internet Explorer (IE) (and usually IE on Windows, not MacOS). The IE 6.0 WinXP setting is good enough to allow Mozilla to log on to the Microsoft Exchange webmail service, which is usually set up to require IE. If you want to run Linux in a mostly Windows organization, install the Preferences toolbar.

Click the Customize button to add other buttons to the Preferences toolbar. You can add buttons to clear your History or Location bar entries. You can even add a Popups button to prevent a page from opening a pop-up window from Mozilla.

Many of the preferences take effect immediately. Others may require you to restart Mozilla.

Adding Java support

If you want to display some Java content, but you only see a broken puzzle piece and a failure message that says you need a plug-in to view application/x-java-whatever content, you can install the software you need from the Sun Microsystems Java Web site (www.java.com). Here's how:

  1. Download the Java 2 Runtime Environment package by visiting www.java.com and selecting Free Download. (Look for a Linux RPM package of the Java RE. I downloaded j2re-1_4_2-linux-i586-rpm.bin.)

  2. Make the package executable and execute it to extract the RPM, as follows:

    # chmod 755 j2re*-rpm.bin # ./j2re*-rpm.bin

  3. Install the j2re* package (as root user), just as you would any software RPM package.

    # rpm -Uvh j2re*rpm

  4. Change to the Java plug-in directory and create a link from the Java plug-in to the Mozilla plug-ins directory. (Instead of *, you could type the whole j2re directory name.)

    $ cd /usr/java/j2rel.4.2_05/plugin/i386/ns610-gcc32 $ ln -s libjavaplugin_oji.so /usr/lib/mozilla/plugins/ $ cd /usr/java/j2re*/plugin/i386/ns610/ $ ln -s libjavaplugin_oji.so /usr/lib/mozilla/plugins/

  5. Close any open Mozilla windows, then open a new Mozilla window.

  6. Click Help ® About Plug-ins. You should see a listing for the Java plug-in and lots of supported Java MIME types.

  7. To see if the Java plug-in is working, you could try out some games from the Java.com site (http://java.com/en/lifestyle/games/).

Doing cool things with Mozilla

There are some neat bells and whistles built into Mozilla that can make your browsing more pleasant. Here are a few of those features that you can try out:

Using tabbed browsing

If you go back and forth among several Web pages, you can use the tabbed browsing feature to hold multiple pages in your browser window at once. You can open a new tab for browsing by simply selecting File ® New ® Navigator Tab or by pressing Ctrl+T. You can also tailor how tabbed browsing works from a Web page or from the Location box. Here's how:

  1. Click Edit ® Preferences. The Preferences window appears.

  2. Click Tabbed Browsing under the Navigator category.

  3. Click one or both of these boxes, depending on how you want to use tabbed browsing:

    • Middle-click, Ctrl+click or Ctrl+Enter on links in a Web page — Selecting this box lets you open a link to another Web page in a new tab. For this to work, click the middle mouse button on a link, hold the Ctrl key while you click the left mouse button on a link, or (with the link highlighted) hold the Ctrl key and press Enter.

    • Ctrl+Enter in the Location bar — After you type a Web address (URL) into the Location box, hold the Ctrl key and press Enter to open the new page in a tab.

  4. Click OK. You can begin using the tabbed browser feature from your Mozilla Navigator.

A tab for each tabbed page appears at the top of the Navigator pane. To close a tab, create a new tab, bookmark a group of tabs, or reload tabs, right-click one of the tabs at the top of the pane. A drop-down menu lets you choose the function you want.

One of the easiest ways to open a link in a tab is to right-click over a link on an HTML page. Select the Open Link in New Tab choice.

Using the DOM Inspector

If you are debugging a Web page that you are creating, the Document Object Model (DOM) Inspector can be useful for checking out the structure of your page. To open the DOM inspector, from the Mozilla window click Tools ® Web Development ® DOM Inspector.

From the DOM Inspector window, type the URL to the Web page you want to check out. The nodes, representing the head, body, tables, fonts, and so on, appear in the left column. Values for each node appear in the right column. Click a node name and the selected area is highlighted on the page below, with the node value appearing to the right.

Resizing the Web page

There is a nice keyboard shortcut that lets you quickly resize the text on most Web pages in Mozilla. Hold the Ctrl key and press the plus (+) or minus (-) keys. The text on the Web page will (in most cases) get larger or smaller, respectively. That page with the insanely small type font is suddenly readable.

Using Mozilla Firefox

With the Firefox Web browser (see Figure 9-5), Mozilla has gone right after Microsoft's Internet Explorer. Firefox is lightweight (so it performs fast), includes many ease-of-use features, and was built with security as a high priority. If you haven't switched to Fedora yet, you can get Firefox for Windows, Mac OS X, and other Linux systems. If you have the Fedora Core 3 DVD that comes with this book, you can try Firefox out right now.

Figure 9-5: Firefox makes it easy to search, do tabbed browsing, and get plugins in a secure way

If Firefox is installed on your Fedora Core 3 system (you need to install the firefox package from the DVD), you can open it by selecting Internet ® Firefox Web Browser from the red hat menu.

Perhaps Firefox's greatest attribute is that it gives you control of what your Web browser does and makes the decision process easy to deal with. For example, if, while you are browsing, Firefox encounters a pop-up window, it gives you options for allowing that pop-up or all popups from that site. If it encounters data that you need special software (such as a plug-in) to play, it helps you search for the needed software and decide if you want the player.

As for major features, here are some highlights of what you can expect to find in Firefox:

Go to the Mozilla Firefox site (www.mozilla.org/products/firefox) for more information on Firefox. For help transitioning from Internet Explorer to Firefox, there's help available from the Foxfire site: www.mozilla.org/products/firefox/switch.html.

Using text-based Web browsers

If you become a Linux administrator or power user, over time you will inevitably find yourself working on a computer from a remote login or where there is no desktop GUI available. At some point while you are in that state, you will probably want to check an HTML file or a Web page. To solve the problem, Fedora Core includes several text-based Web browsers.

With text-based Web browsers, any HTML file available from the Web, your local file system, or a computer where you’re remotely logged in can be accessed from your shell. There’s no need to fire up your GUI or read pages of HTML markup if you just want to take a peek at the contents of a Web page. Besides letting you call up Web pages, move around with those pages, and follow links to other pages, some of these text-based browsers even display graphics right in a Terminal window!

Which text-based browser you use is a matter of which you are more comfortable with. Browsers that are available include:

The w3m command seems the most sophisticated of these browsers. It features a nice default font selection, seems to handle frames neatly, and its use of colors also makes it easy to use. The links browser lets you use the mouse to cut and paste text.

You can start any of these text-based Web browsers by giving it a filename, or if you have an active connection to the network, a Web address. For example, to read the w3m documentation (which is in HTML format) with a w3m browser, you can type the following from a Terminal window or other shell interface:

$ w3m /usr/share/doc/w3m-0*/doc/MANUAL.html

An HTML version of the W3M Manual is displayed. Or you can give w3m a URL to a Web page, such as the following:

$ w3m www.handsonhistory.com

After a page is open, you can begin viewing the page and moving around to links included in the page. Start by using the arrow keys to move around and select links. Use the Page Up and Page Down keys to page through text.

Категории