Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove Headers and Footers

Status
Not open for further replies.

tlmm

Programmer
Mar 25, 2004
45
CA
Hi,

I am using the following code on a page that users will print off. It stops the headers and footers that normally appear from appearing when a web apge is printed. E.g. the page URL that appears at the bottom of the page.

<script type="text/vbscript">
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\PageSetup\header", ""
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\PageSetup\footer", ""
</script>

The problem is now that when the page is run, this error appears:

an activeX control on this page might be unsafe to interact with other parts of the page

Is there something I can do to stop this or fix this?

Thanks.
 
I realize that this is a security setting in Internet Explorer and that I probably shouldn't try to override it, so maybe a better question is:

Does anyone know another way of getting the headers and footers NOT to print?

Thanks again.
 
Well, you can't control them via CSS (PrintStyleSheets) which has always been a bummer.

The headers/footers are considered user-controlled items, so probably anything you do to them will require some sort of hack.

IE supports "Print Templates" that might do the trick, but they can't be used from HTML, script, or even VB - only from C++ (Print Customization for Internet Explorer 5.5). Therefore basically nobody uses them because curiously enough this sort of issue isn't interesting to a C++ programmer.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top