The Web Design Group

Web Authoring FAQ: Other Media

This list of Frequently Asked Questions is maintained by the WDG and was last updated on November 29, 1999. It may be found at the following URLs:

If you would like to contribute to this FAQ, please send mail to <>. All contributors will be listed at the bottom of the FAQ.

5. Other Media

  1. How do I let people download a file from my page?
  2. Why did my link to a _______ file only download a bunch of characters instead?
  3. How do I force a download?
  4. How do I make animated GIFs?
  5. How can I create a thumbnail image that is linked to the full-sized image?
  6. Why am I getting a colored whisker to the left or right of my image?
  7. How can I display random images?
  8. Why are my images coming out all wrong or not loading?
  9. How do I prevent people from saving my images?
  10. Can I put markup in ALT text?
  11. How do I get an audio file to play automatically when someone visits my site?
  12. How can I strip all the HTML from a document to get plain text?

5.1. How do I let people download a file from my page?

Once the file is uploaded to the server, you need only use an anchor reference tag to link to it. An example would be:

<a href="../files/">Download Foo Now! (100kb ZIP)</a>

It is possible that the server might need to be configured for some different file types. (See the next Q&A.)

[Table of Contents]

5.2. Why did my link to a _______ file only download a bunch of characters instead?

If you are trying to link to a particular type of file and it is not returning your desired response, chances are that the server needs to have the type configured. Talk to your system administrator about getting them to add the content type. Here is a list of common types that often need configuring:

Content Type Description
Application/msword Microsoft Word Document
application/octet-stream Unclassified binary data (often used for compressed file or executable)
application/pdf PDF Document
application/wordperfect6.0 WordPerfect 6.0 Document
application/zip ZIP archive
audio/x-wav WAV audio format
audio/midi MIDI audio format
audio/x-pn-realaudio RealAudio
image/gif GIF image format
image/jpeg JPEG image format
image/png PNG image format
text/html HTML document
text/plain Plain text
video/mpeg MPEG video format
video/quicktime QuickTime video format
video/x-msvideo AVI video format

Another method of ensuring that your file is properly sent to the client is to compress it into a standard compression format. Virtually all servers are set to handle the .zip extension and it is widely recognized by users.

Some servers (NCSA, Apache, and others) can be configured to support user-configured content types. Details are server dependent, so consult your server admin or documentation.

Note that Internet Explorer incorrectly ignores server-provided MIME types, so it sometimes "does the right thing" when the server is misconfigured. Other browsers correctly heed the server-provided MIME types, so they will reveal server misconfigurations.

[Table of Contents]

5.3. How do I force a download?

You can't, because the Web doesn't work that way.

Here's the explanation. When someone downloads a document, the server tells the browser what type of file it is. The browser then displays it or picks the appropriate helper application. If the server doesn't know the file type, it tells the browser that the file is "text/plain", or just plain text (true for most servers). You may need to ask your server admin to configure this particular file with the MIME type you want.

"Forcing" a download is not what you are supposed to do. After all, what is more convenient than having the proper application started when I download a particular file? Browsing through a download directory can be quite a pain. And most browsers allow the user to download to disk if they want to.

If the file must be saved to disk, if there is absolutely NO other way to handle it, the MIME type should be "application/octet-stream".

[Table of Contents]

5.4. How do I make animated GIFs?

Check out the following resources:

[Table of Contents]

5.5. How can I create a thumbnail image that is linked to the full-sized image?

A thumbnail image is just a copy of the full-sized image that has been modified to reduce the size of the file. It is linked to the full-sized image with a normal link:

<A HREF="full-sized.jpg"><IMG SRC="thumbnail.jpg" ALT=...></A>

There are several techniques for reducing the size of the file for the thumbnail image, including

Thumbnail images can use multiple techniques simultaneously. For example, Jakob Nielsen advocates "Relevance-Enhanced Image Reduction", which combines resampling/resizing and cropping.

[Table of Contents]

5.6. Why am I getting a colored whisker to the left or right of my image?

This is the result of including "white space" (spaces and newlines) before or after an IMG inside an anchor. For example:

<A HREF=...>
<IMG SRC=...>

will have white space to the left and right of the image. Since many browsers display anchors with colored underscores by default, they will show the spaces to the left and right of the image with colored underscores.

Solution: don't leave any white space between the anchor tags and the IMG tag. If the line gets too long, break it inside the tag rather than outside it, like this:

<A HREF=...><IMG

Style checkers such as Weblint will call attention to this problem in your HTML source.

[Table of Contents]

5.7. How can I display random images?

There are two basic approaches. The most cache-friendly method is to use a normal IMG tag that refers to a CGI script that randomly redirects the browser to one of several images. There is an example of such a CGI script at <URL:>. See the CGI Programming FAQ <URL:> for more information about CGI.

The second method is to generate the HTML dynamically using a mechanism like Server Side Includes (SSI) or CGI. This method is less cache-friendly, but it does allow the surrounding markup (e.g., HEIGHT and WIDTH attributes, or the URLs for linked/image-mapped images) to vary with the image. If your server supports SSI, the details can be found in your server documentation.

[Table of Contents]

5.8. Why are my images coming out all wrong or not loading?

Most likely you forgot to close a quote at the end of the SRC attribute. Alternatively, perhaps you used a ">" character in an ALT text or somewhere else inside a tag. Although this is legal, several older browsers will think the tag ends there, so the rest is displayed as normal text.

This especially happens if you use comment tags to "comment out" text with HTML tags. (See the answer to "How can I include comments in HTML?") Although the correct syntax is <!-- --> (without "--" occurring anywhere inside the comment), some browsers will think the comment ends at the first ">" they see.

Validators will show you any syntax errors in your markup, but checkers such as Weblint and HTMLchek can show you where you are liable to provoke known browser bugs. See also the answer to "How can I check for errors?"

[Table of Contents]

5.9. How do I prevent people from saving my images?

You can't. The image file is necessary for the browser to display your document; you must send it to the browser. Even if a particular browser doesn't have a "Save Image" feature, there are many that do, and someone can always retrieve the image file by hand (using telnet) or from the browser's cache.

There are tricks that make it more difficult for some readers to save your images. However, just as with tricks that try to hide HTML source, these tricks cause various problems for law-abiding users and can't really prevent thieves from saving your images.

[Table of Contents]

5.10. Can I put markup in ALT text?

No. Character entities (&copy;, &#nnn; and such) are permitted, though.

If you want to know how to write good ALT texts without markup, please see Alan Flavell's essay on choosing ALT texts at <URL:>.

[Table of Contents]

5.11. How do I get an audio file to play automatically when someone visits my site?

Most browsers support the EMBED element for this, provided that the user has a suitable plug-in for the sound file. You can reach a slightly wider audience if you use BGSOUND as well. To avoid problems with browsers that support both, place the BGSOUND in a NOEMBED container:

<EMBED SRC="your_sound_file" HIDDEN=true AUTOSTART=true>
<NOEMBED><BGSOUND SRC="your_sound_file"></NOEMBED>

For more on the EMBED element, see <URL:>. See <URL:> for more information on BGSOUND. Note that these elements are proprietary and not in any HTML standard. (The HTML standard way of doing this is not well supported.)

Be aware that some users find it annoying for music to automatically start playing. They may not have the volume set properly on their speakers, or they may be listening to something else. As a courtesy to your users, you may prefer to offer the sound file as a link:

<A HREF="your_sound_file">Listen to my sound! (5 kB MIDI)</A>

[Table of Contents]

5.12. How can I strip all the HTML from a document to get plain text?

Many browsers have a "Save As..." function that allows you to specify plain text as the output format. Another approach is to select all the text, copy it to the clipboard, and paste it into an editor.

Lynx users can use "lynx -dump http://..." on the command line to print to file and append a list of referenced URLs as footnotes. If you want the output file without the footnotes, use the "p" command to "print" to a text file.

Some HTML authoring tools have an option to strip all HTML as well. Two programs of note are

If you are looking for another method (in other words you want to make things more difficult on yourself), you can obtain programs which will strip away all HTML markup from a document. Try doing a search at <URL:> for the phrase "HTML stripper".

[Table of Contents]

For additions or omissions to this FAQ, please contact <>.

All information contained herein was originally compiled by members of the Web Design Group, principally Arnoud "Galactus" Engelfriet, John Pozadzides, and Darin McGrew.

Additional input has been provided by Boris Ammerlaan, Lori Atwater, Alex Bell, Stan Brown, Roger Carbol, Alex Chapman, Jan Roland Eriksson, Jon Erlandson, Mark Evans, Alan Flavell, Lucie Gelinas, Bjoern Hoehrmann, Tina Marie Holmboe, Peter Jones, Nick Kew, Jukka Korpela, Simon Lee, Nick Lilavois, Neal McBurnett, Glen McDonald, Dan McGarry, Ken O'Brien, Timothy Prodin, Steve Pugh, Liam Quinn, Colin Reynolds, Kai Schätzl, Doug Sheppard, Sue Sims, Toby Speight, Warren Steel, Ian Storms, Peter Thomson, Daniel Tobias, and Diane Wilson.

Thanks everyone!

Home, Reference, FAQs, Tools, Design, Feature Article, BBS, Links

Copyright © 1996-1999. Web Design Group All rights reserved.