Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

detect when printing with javascript

how can I detect when print stylesheet is active

7:16 pm on Mar 22, 2007 (gmt 0)

New User

10+ Year Member

joined:Jan 18, 2005
votes: 0

Hi folks,

I'm having a problem with a print stylesheet breaking because of a dynamic javascript div resize. You can see the details here:


I've tried to detect the css display of certain page elements in order to determine if the page is printing, but for some reason I'm getting the values of the screen css, even when printing.

Is there some way I can detect when the user is printing, or when the print stylesheet is active, using javascript? I know about onBeforePrint, but that's IE only, and this problem only happens in Firefox.

Thanks for any help.