Reputation: 1216
I have an HTML-page with some data in table format, and this code:
function printme() { window.print(); self.close(); } <body onload = "javascript:printme()">
With this, I can get printout from all browsers except one version of IE8 (8.0.7601.xxxxx), which prints a blank page.
Am I missing something?
Upvotes: 1
Views: 2881
Reputation: 502
i face the same issue often with IE, try this define it in header may be solve your issue.
<meta http-equiv="X-UA-Compatible" content="IE=8" />
Upvotes: 1
Reputation: 324810
The problem may be caused by closing the window before the page is printed, causing the memory of the page to be freed and resulting in a blank print.
Also, why do you use window.print
and self.close
when window == self
in this context?
Upvotes: 3
Reputation: 15812
You don't need the javascript:
prefix for events like onload
, as they are expecting Javascript anyway.
Generally, javascript:
is only needed for <a href="javascript:...
(some other things as well, but that's the most common one).
The most likely problem is that IE8.0.7601... for some reason has a quirk which means it doesn't just ignore it, whereas other browsers and other versions of the same browser handle it without any problem.
Upvotes: 0