Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Using the window.print() method in Javascript

Crossbrowser support

4:54 pm on Jun 5, 2003 (gmt 0)

New User

10+ Year Member

joined:Aug 12, 2002
votes: 0


I have a web page at the following url


At the bottom of the page is a link to print the page. Now this seems to work on Windows PC's but not on Mac in Internet Explorer.

The code i have used is below and I just wondered if any one knew of a way to get this to work in Explorer. The code seem to work in Netscape on the Mac and as I have said there is no problem in Explorer on windows PC's

<a href="JavaScript: onclick=window.print();" class="hlink">print</a>

Any ideas on this would be appreciated.


[edited by: korkus2000 at 5:07 pm (utc) on June 5, 2003]
[edit reason] no personal URLs please [/edit]

5:14 pm on June 5, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 20, 2002
votes: 0

IE5+ will do window.print. Call the method without the onclick in the href like:

<a href="JavaScript:window.print();" class="hlink">print</a>

5:22 pm on June 5, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 31, 2001
votes: 0

Save the code and drop the link. "Print" is just a mouseclick or keystroke away by default.