web blazonry web development scripts and tutorials Get best price on Prepaid Samsung Galaxy A01
   PHP       Name Generators       Perl       CSS       Javascript       Java       MySql       How Tos       Resources   

How Tos Home

Free Linux Books
  Programming for Linux
  Sys & Network Admin
  On the Desktop

Articles
Tech Tips for Picking a Web Host

Database Tutorial (PHP & MySQL)

How to Instal Apache + PHP + MySQL

PHP vs. ASP vs. JSP

Introduction to Debugging

MySQL JDBC Drivers

Overview of Client Side

Margins Flush with Edges of Browser

Specifying Alternate Document to Print

Web App Security
  Who Submit That?
  Cookie Security
  Passwords
  Secure Web Development

Bookmark and Share





Specifying Alternate Document to Print

Written by John Miller
of Dynamicdrive.com

Printing a page online usually means printing more than what you actually want. Webpages are quite fancy nowadays, with ad banners on top, navigational links on the left, and so on. That's fine when you're viewing the page online, but when you're printing the page, you only want to print out the "actual content", and nothing else from the page! Many sites nowadays understand this, and provide an alternate "print" version of the document that surfers can go to and print out. Well, there's actually a much more elegant and seamless way of accomplishing the same thing, and that is by using the <link> tag. IE 4+ (and hopefully NS 6 when it officially releases) supports a version of the <link> tag that allows you to specify to the printer which file it should print when the user selects print. In other words, the job of locating the alternate print version of the document to print out is left to the printer, instead of the surfer. Take a look at the below example, and it will all be clear.

Let's say you're interested in only printing out the content in gray below from this page. As the webmaster, I could have helped you out by creating another HTML document with only the below content, and telling you to go there and print that document instead. However, I'm not going to do that. Instead, I've prepared a Word document called printversion.doc, and by adding the following:

<link rel="alternate" media="print" href="printversion.doc">

to the <head> section of this page, informed the printer to directly proceed to printversion.doc and print it when you select "print" on this page. In other words, the printer will print out printversion.doc instead when you choose "print" on this page. To see this in action, try printing this page now (you'll need IE 4 or above)!

The following article discusses what DHTML is, and also the differences in implementation of DHTML between Netscape Communicator and MS Internet Explorer 4.

What is DHTML?
Dynamic HTML (DHTML) is a technology supported by Netscape Communicator and IE 4 that enables a web document to be dynamic. DHTML is NOT JavaScript, but rather, a generic enhancement to the browser itself that allows elements to be moved around, content to appear and disappear, text to change even after the document has loaded etc. JavaScript (or any other scripting language, for that matter), merely provides the means to access these enhancements. DHTML is not a programming language, but a feature.

What's the difference between DHTML in Communicator, and in Internet Explorer 4.0?
Everything. Communicator and Internet Explorer 4 are currently at very different stages in terms of support for DHTML as recommended by WC3. In short, Communicator is considered vastly behind in its support for true DHTML, while IE 4 is more on track. Its important to realize that both browsers do not yet completely support the DHTML technology as outlined by the WC3. Below lists how Dynamic HTML is implemented in the two browsers:

In Communicator:

  • Dynamic HTML is mainly realized through the <layer> tag. The <layer> tag can be moved around, hidden or displayed, its content dynamically changed, etc. Netscape 4 relies exclusively on this one tag when it comes to DHTML.

In Internet Explorer 4:

  • Dynamic HTML is realized through the browser itself (as opposed to any one tag), with the entire browser able to be dynamic. All elements in a document can be dynamically accessed and altered on demand, even after the document has loaded.

Demonstrations of DHTML in both browsers can be found at http://www.dynamicdrive.com/

If you're using IE 4+, the output should be a word document that contains only the contents of the gray box above.

As NS moves to support this new CSS definition (it should be in NS 6), it's only a matter of time now that the job of specifying a print version of our webpages becomes a lot simpler and elegant.


This tutorial is written and contributed by John Miller of Dynamicdrive.com. Visit http://www.dynamicdrive.com for free, original DHTML scripts to enhance your site. Categories include menus, images, mouse trail effects, and more.

 

Newest Pages
Test Google Ads Ver. 2
Free Linux Admin Books
Free Linux Books for Programmers
Free Books for Linux on the Desktop
Free PHP Books
Free JavaScript Books
Free Java Books - Advanced
Free Java Books - Basic
Free Perl Books
Free Python Books
Quote of the Day (PHP)
Debugging Part 2
How to Test Google Ads
Most Popular Pages
Baby Name Generator
U.S. Name Generator
Wu Name Generator
Popup Windows (JavaScript)
Upload and Resize an Image (PHP)
How To Install Apache + PHP + MySQL
Intro to Web Databases (PHP, MySQL)

Least Popular Pages
iNews Applet (Java)
Java Resources
Site Monitor (Perl)
PHP Resources
 
 

  privacy policy     ||     © 1997-2016. astonishinc.com   All Rights Reserved.