print this page link

message from arizona on 16 Jul 2004
Hi, I am trying to make a printer friendly version with a 'print this page'
text link. So far I have found none of them work on the macintosh. Does
1. <A HREF="#" onClick="window.print();return false">Print this Page</A>

2. <a href="javascript:print()">Print This Page</a>

3. adding this to the head of the document
<script>
function print_page(where){
var is_mac=(navigator.platform.indexOf("ac") != -1);
(document.all && is_mac)?
alert("Select \"Print\" from the menu") : where? where.window.print() :
window.print();
}
</script>

then the link is: <a href="javascript:print_page()">Print this</a>

Number three at least got a result, but not the one intended...I got an
Internet Explorer Script Alert 'Select "Print" from the menu"

I am on OS 9.2.2, IE 5.1.7

It isn't that the mac users won't automatically know to go to the print
menu, but I would like to know if there is a print this page link that works
cross browser/os systems...

tia
Barbara
 
Alan replied to arizona on 16 Jul 2004
Js doesn't have access to a print command on macintosh afaik.

you could sniff for platform and put an escape to an Alert in the function-
"Please use the Print button in your Browser's Menu"

or put the entire function inside of a platform sniffer so it doesn't even
put the Print this Page link on the page if it's a mac.

If it's a popup window with no toolbar so windows users don't see a print
button on the browser window- Mac users will still have access to the
browser's menu to File-->Print
 
arizona replied to Alan on 16 Jul 2004
Seems like too much work when the user just needs to go to their browser
window and click the print button. So, thanks for the info, I will just add

"Please use the Print button in your Browser's Menu"
 
Murray *TMM* replied to arizona on 16 Jul 2004
That's the intended result of that script for Mac users.

You cannot trigger a programmatic print in IE5/Mac.
 

Archived message: print this page link (Macromedia Dreamweaver)