[thelist] Javascript window.print function

Michiel Oosterling michiel.oosterling at hinttech.com
Thu Nov 13 07:12:17 CST 2003


Hi,

I have an (x)html document that users need to be able to print out, 
however, due to our nice friends from Redmond, IE doesn't really handle 
the rel="alternate stylesheet" attribute too well.
I devised a way of being able to still do the print thingie via css by 
reloading the page and rewriting the css tag in the header to point to 
the print stylesheet. This is a dirty hack, and I would very much like 
to do something along the following lines, misusing the window.print 
function in javascript, given this can actually be done:

javascript:document.URL.print('doc.html?action=print');
 - or -
javascript:document.self.print('doc.html?action=print');

Agreed, this is another dirty hack, but if someone has a nice method of 
printing out a document along the lines of window.print(); using a 
'print this doc' image/link and be able to use the alternate print style 
sheet, oh and it really should work on most accepted graphical browsers.
If this is possible, I want to keep it within the same doc, due to the 
templating system we're using here. (some nightmare app called Tridion :) )

Regards,

Michiel Oosterling



More information about the thelist mailing list