...

View Full Version : window.print() for mac



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

beetle
07-10-2003, 07: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?

paolaban
07-10-2003, 08: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...

Kor
07-10-2003, 03: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!" :-)

Kor
07-10-2003, 03:13 PM
Well, maybe here
http://www.oreillynet.com/pub/a/javascript/2001/05/11/js_for_mac.html

you might get a solution

beetle
07-10-2003, 04: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.

Cymru
08-04-2003, 01: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>

<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! :)

link92
08-04-2003, 10: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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum