The print window is not shown when the page contains an iframe in IE6 (XPsp2)

C

colinzhu

I want to have the print dialog shown automatically after the the page
is loaded, but when I try to call window.print() BEFORE the iframe,
the print dialog is not shown at all. Anyone can help?

Here is my code:

<html>
<head>
<title>Auto print the page</title>
</head>
<body>

****** The area in my control START *******
text
text
<script type="text/javascript">window.print()</script>
****** The area in my control END *******

other content out of my control
<iframe src=""></iframe>
</body>
</html>

Please note:
1. For some reasons <body onload="window.print()"> is not allowed,
it's out of my control
2. The print dialog should be shown without any other action e.g.
click. So onclick="window.print()" is not allowed.
3. The entire page should be printed, so ExecWB(6,1) &
execCommand("Print") are useless, because they only print the content
BEFORE the calling of ExecWB(6,1) or execCommand("Print")
4. The <iframe> should not be removed or changed, it's out of my
control.
5. It works in Firefox
 
C

colinzhu

colinzhu said the following on 5/14/2007 11:11 AM:









window.onload = new Function(){window.print()}

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/


Thanks for your replay, but this method is not allowed also.

I fount a solution today, that is to use:
window.setTimeOut("window.print()", 1) , I don't know why, but it just
works.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top