Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: JavaScript
Expertise: Advanced
Jul 28, 2003



Application Security Testing: An Integral Part of DevOps

Print an HTML Page Without Displaying the Print Dialog Box

The following piece of code is a sample example that can print a HTML page without showing the print-popup dialog box. NOTE: It is restricted with IE 5.5 SP2 onwards.


<script LANGUAGE="JavaScript">

// The code below does work  and is tested with IE 5.5 SP2.
function printitWithoutDialog()
		if ((navigator.appName == "Netscape"))
			window.print() ;
			var WebBrowser = 
'<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0
	document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
	WebBrowser1.ExecWB(6, -1);
	WebBrowser1.outerHTML = ;



<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>

<a href="javascript:printitWithoutDialog() ">print this page</a>

Supal Chowdhury
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date