View Full Version : window.print() for mac

07-10-2003, 07:01 AM
window.print() works on pc but not for mac. How can i make a printable page for mac users?

07-10-2003, 08:01 AM
window.print() doesn't "make a printable page" on PCs either. Which question are you really asking?

1) How can I duplicate the funcitonality of window.print() for Macs
2) How can I create a printer friendly page?

07-10-2003, 09:19 AM
i have a button, when you press it you can print the html page you see on screen. Just href="javascript:window.print()".
This works on pc (you can print the page) but in mac nothing happends... It doesn't "read" the function js window.print...

07-10-2003, 04:07 PM
As far as I know print() works only for NS on Mac, not for IE, I don't know why. And tere is no other function in JavaScript to do that for IE on Mac.

So, as a friend said..." choose "File" from browser's menu, then choose "Print" an here it is!" :-)

07-10-2003, 04:13 PM
Well, maybe here

you might get a solution

07-10-2003, 05:46 PM
Interesting link, Kor, but I doubt that will work. It talks about using JavaScript with Mac OS's Open Scripting Architechture - not in a web browser. I doubt the necessary objects (such as MacOs) are exposed to a browser.

Also, it is clear to see from the bottom of this page (http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/print.asp), that IE-Mac doesn't support window.print()

Sorry, I think you're SOL.

08-04-2003, 02:41 PM
Will this script work?

<SCRIPT Language="Javascript">
function printit(){
if (window.print) {
window.print() ;
} else {
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = "";

<SCRIPT Language="Javascript">
var NS = (navigator.appName == "Netscape");
var VERSION = parseInt(navigator.appVersion);
if (VERSION > 3) {
document.write('<form><input type=button value="Print this Page" name="Print" onClick="printit()"></form>');

I don't have a Mac so I cannot test it, but I hope it works! :)

08-04-2003, 11:34 PM
The one above dosn't work, I've got a mac and IE and I tested it and it makes the whole page vanish.