[jQuery] add a print event to jquery: possible ?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META content="MSHTML 6.00.6000.16481" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=468131614-01082007><FONT face=Arial size=2>hello
friends!</FONT></SPAN></DIV>
<DIV><SPAN class=468131614-01082007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=468131614-01082007><FONT face=Arial size=2>question: is it
possible to catch the print event via javascript/ jquery?
</FONT></SPAN></DIV>
<DIV><SPAN class=468131614-01082007><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=468131614-01082007><FONT face=Arial size=2>AFAIK, only IE has
built-in capabilities :</FONT></SPAN></DIV>
<DIV><SPAN class=468131614-01082007></SPAN> </DIV>
<DIV><SPAN class=468131614-01082007>window.onbeforeprint</SPAN></DIV>
<DIV><SPAN class=468131614-01082007>window.onafterprint</DIV>
<DIV><PRE><SPAN class=468131614-01082007>I did a quick test, and in fact it is possible to overwrite the window.print function: </SPAN></PRE><PRE><SPAN class=468131614-01082007>window.print = function(o){alert("hi");};</SPAN></PRE><PRE><SPAN class=468131614-01082007>wouldn't it be possible to therefore to include a "print" event to jquery, which overwrite the default print and allows to perform dom manips before printing?</SPAN></PRE><PRE><SPAN class=468131614-01082007>i'm asking this because i change the content of a span element so as to only show it via a cluetip. </SPAN></PRE><PRE><SPAN class=468131614-01082007>That's working fine, except that when printing the document, it print<SPAN class=468131614-01082007>s</SPAN> the html source after DOM manips ("more info") <SPAN class=468131614-01082007>instead of before modification of the DOM (address, city, postcode information)</SPAN>.</SPAN></PRE><PRE><SPAN class=468131614-01082007><FONT face="Courier New">$('span.moreInfoLink').text('more info').cluetip();</FONT></SPAN></PRE><PRE><SPAN class=468131614-01082007>therefore, i would have loved to be able to disable this on a print() event...</SPAN></PRE><PRE><SPAN class=468131614-01082007></SPAN> </PRE><PRE><SPAN class=468131614-01082007></SPAN> </PRE><PRE><SPAN class=468131614-01082007>thanks!</SPAN></PRE><PRE><SPAN class=468131614-01082007></SPAN> </PRE><PRE><SPAN class=468131614-01082007>Alexandre</PRE></SPAN></SPAN></DIV></BODY></HTML>
<BR>
<P><FONT SIZE=2>Ce message Envoi est certifié sans virus connu.<BR>
Analyse effectuée par AVG.<BR>
Version: 7.5.476 / Base de données virus: 269.11.0/929 - Date: 31/07/2007 17:26<BR>
</FONT> </P>