Get best price on Unlocked Samsung Galaxy A21 | ||||||||||||
|
||||||||||||
|
Specifying Alternate Document to PrintWritten by John Miller 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)!
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.
|
privacy policy || © 1997-2016. astonishinc.com All Rights Reserved. |