Inconsistent window.print behavior in Netscape and IE6

P

Prasoon

I have a JSP page on which when print is pressed - Records are fetched
on a redirected page and those are to be printed.
I use the lines -
<script language="javascript">
window.print();
history.back();
</script>
to do the same.

When browsed from Netscape 4.7, the Resultset page is printed
perfectly whereas in IE6, the resultset page is generated and the
source page is printed i.e. the one where Print command was given

Is there a workaround for IE6 for the same which will let me print the
Result page silently without changing the sequence of operations for
the user?
 
T

Tom Cole

I have a JSP page on which when print is pressed - Records are fetched
on a redirected page and those are to be printed.
I use the lines -
<script language="javascript">

Replace this with said:
window.print();
history.back();
</script>
to do the same.

When browsed from Netscape 4.7, the Resultset page is printed
perfectly whereas in IE6, the resultset page is generated and the
source page is printed i.e. the one where Print command was given

Is there a workaround for IE6 for the same which will let me print the
Result page silently without changing the sequence of operations for
the user?

Your code is getting run inline. What you should do is put your code
inside a function block and call that function from the onload event
handler:

<script type="text/javascript">

function doPrint() {
window.print();
history.back();
}

</script>

<body onload="doPrint();">
....
</body>

HTH.
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top