You are here: irt.org | FAQ | JavaScript | Print | Q1457 [ previous next ]
The user will have to accept the print request, otherwise anyone could print on your printer just by having you visiting their site.
Add this to the bottom of page to be printed:
<object id=WBControl width=0 height=0 classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2></object> <script language=VBScript><!-- // Sub VBPrint() On Error Resume Next WBControl.ExecWB 6,1 End Sub //--></script> <script language=JavaScript><!-- // if (window.print) self.print(); else if (navigator.appName.indexOf('Microsoft') !=-1) VBPrint() setTimeout('self.close()',3000); //--></script>
and simply have a:
<form> <input type="button" value="Print Price List" onClick="window.open('pricelist.html','newwin');"> </form>
on the other page.