[thelist] Printing Problems -- How to Disable

Burhan Khalid burhankh at hotmail.com
Fri Dec 7 10:44:31 CST 2001

Hey there Evolters :

  Forgot who originally proposed the question of disabling printing, so I 
will start a new thread on the topic.

Remember this :

The only surefire way of disabling printing in IE is via the registry, so, 
you can pretty much forget about it via the web (as in remotely editing 
registry keys).

Having said that, note this piece of code :

function hide() {
	document.getElementById('secretcontent').style.display = 'none';

function show() {
	document.getElementById('secretcontent').style.display = '';

<body onbeforeprint="hideAll()" onafterprint="showAll()">
<div id="secretcontent">
...your page here...

This piece of code utilizies the onbeforeprint, and onafterprint events that 
are available in IE. This should work for certain areas of the page. But, as 
you can see, its just a hide script, so there would be no way to actually 
have the user see the content, before the print it.

Well, maybe there is....

The new version of IE (5.x+) provided the much hyped print preview feature. 
Along with this, came the print template option. You can, if you can get 
through the labyrinth that is msdn.microsoft.com, find out ways to 
manipulate this so that you can disable printing, but enable print preview. 
I have been so kind as to have done the digging for you :

(mind the wrap)

Hoping this helps someone,
Burhan Khalid

Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

More information about the thelist mailing list