Here's What's Happening
Actually, I didn't forbid you at all. The page that printed was what's known as an alternative page. I set up a command in the HEAD tags that stepped in and redirected the print command that you sent to the browser. Basically, I set up a route that lead the browser away from the page you were currently looking at. Here's the code that did it:
<link rel=alternate media=print href="printversion.txt">
Just that. Here's what's happening:
- link denotes the relationship of something being a link. That "something" will be set soon.
- rel denotes the relationship of this link. What it will do is set up an alternative to the default. In this case, the default will be to print the page. We're going to stop that.
- media tells the links what media to deal with. At the moment, only "print" is supported. Other attributes include Braille, handheld, screen, projection, and tv but none are up and running yet.
- href tells the command to use this address as the alternate.
So what actually happened?
I set up the command so that it would step in and redirect the browser's print function to print another page. In this case, you printed "printversion.txt". That page said that you didn't have permission to print the page.
Pretty tricky, eh? You actually did print something, but the effect was that you were denied the ability to print. Please, note that you can print other formats. When John sent me the command he had it set to print a WORD document. As long as the user's computer has the ability to read the page, it can be printed. I just went with a text page because I know that all computers, no matter what their level of advancement, can print text.
Other Uses
Outside of giving the impression that I stopped your ability to print, I see this being very helpful with forms or charts or just about any other support document required for a site. For example, maybe you have a page that requires a user to fill out a form. You could use this tag to make it so that all one needed to do was hit the print button and the form prints out. If you have a chart in XLS format, you could do the same.
I would use an internal browser test JavaScript to test the person's browser when using the command. You could set up the internal test so that if the user is running IE4 or better that text would be written that reads, "To get the form, simply click your print button". If the browser is different, then set the JavaScript to write a hypertext link so that user can go to a page and print the form.
I wish this command were more widely available because I see a great many uses for it. In fact, I intend to set up just such a format in one of my online classes. It would be a great way to distribute homework to students.
And students just love that homework, let me tell you.
Enjoy!
[Here's What's Happening]
[Other Uses]
Back To The HTML Goodies Home Page