Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does document.body.offsetHeight do before window.print()?

Sniffing gmail's Print all link source code, there's something like this:

<script>
function Print(){document.body.offsetHeight;window.print()};
</script>
</head>
<body onload="Print()">

What does document.body.offsetHeight do?

like image 811
systempuntoout Avatar asked May 03 '10 20:05

systempuntoout


1 Answers

It forces WebKit based browsers to load the complete set of content before printing (including images, styles, etc.)

like image 164
Justin Niessner Avatar answered Sep 29 '22 13:09

Justin Niessner