|
|
Q49 Can I print the current page?
irt.org | Knowledge Base | JavaScript | Print | Q49 [ previous next ] Q49 Can I print the current page?In JavaScript 1.2 (i.e. Netscape 4.0) there is a new print method that invokes the print dialogue box. Internet Explorer 5 beta 2+ also supports the print method. Before using this method you must test that the browser supports it by testing the window object for a print property:
The syntax is simply:
windowReference.print() The following will display a print button for JavaScript 1.2 only:
Since the above was written Microsoft have released Internet Explorer 4 which supports JavaScript 1.2, but not the window print method. So the following cludge is required to stop the button appearing on Internet Explorer (note it no longer requires the use of JavaScript1.2 - perhaps its not that much of a cludge after all):
This bug was reported by Andrew Shatwell - thanks Andrew. Feedback on 'Q49 Can I print the current page?' |
-- div -->
|