Re: Programming Netscape to Disable Print Headers and Footers

"A. Fool" <[email protected]> Wed, 25 Aug 2004 10:04:24 -0500
Newsgroups gmane.comp.mozilla.devel.prefs
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Robert,

Glad you asked.  I love any opportunity to share and exchange knowledge. 
  Anyways, the code modifies the client's head/footer settings by 
directly changing the registry settings.  A no-no in Netscape, and one 
of the main (if not THE main) reasons that these continue worms 
proliferate.  Such functionality is a double-edged sword.  But knowing 
Microsoft (and the Corporate Elite in general), this hole is probably 
intentional.  Have you noticed how the demand and pricing for 
anti-virus/security software has skyrocketed over the past 3 years?

Okay.  Enough of the "fight the power" ranting.  Here's the code:

////////// BEGIN CODE //////////

<html>

<head>
<title>Order Details</title>
<script language="VBscript">
     Dim WSHShell
     Dim myHeader
     Dim myFooter
     Set WSHShell = CreateObject("WScript.Shell")
     myHeader = WSHShell.RegRead("HKCU\Software\Microsoft\Internet 
Explorer\PageSetup\header")
     myFooter = WSHShell.RegRead("HKCU\Software\Microsoft\Internet 
Explorer\PageSetup\footer")

     WSHShell.RegWrite "HKCU\Software\Microsoft\Internet 
Explorer\PageSetup\header", ""
     WSHShell.RegWrite "HKCU\Software\Microsoft\Internet 
Explorer\PageSetup\footer", ""

     Sub ResetHeader()
         Dim WSHShell
         Set WSHShell = CreateObject("WScript.Shell")
         WSHShell.RegWrite "HKCU\Software\Microsoft\Internet 
Explorer\PageSetup\header", myHeader
         WSHShell.RegWrite "HKCU\Software\Microsoft\Internet 
Explorer\PageSetup\footer", myFooter
     End Sub
</script>
</head>

<body onload="javascript:window.print();" onunload="ResetHeader()">

////////// END CODE //////////

Let me know if you have any questions.  And oh yeah - FIGHT THE POWER!  LOL

-- A. Fool
Robert wrote:
>>The issue at hand is a client is wanting the header and footer to remain 
>>hidden when printing, because the printed page is to be filed (they're 
>>invoices).  I've managed to do this successfully in Internet Explorer, 
>>but have had NO luck in reproducing this functionality in Netscape.
> 
> 
> Just wondering, how did you do this in Interent Explorer?
> 
> -Robert