window.print not working in ie8

Hi,
I want to make this page print and then redirect to another page. Below is my code:
<script type="text/javascript">
<!--
window.print();
//-->

<!--
 window.location = "service_view.php?ticket_id=<?= $ticket_id; ?>"
//-->
</script>

This works just fine in FireFox, but in IE8 the page just redirects and does not print. Help please!
computerheavenAsked:
Who is Participating?
 
Umar TopiaConnect With a Mentor .Net Full Stack DeveloperCommented:
Try this
<script type="text/javascript">
if (window.print)
document.write("<a href='http://myredirect.com/page.html' onclick='window.print();'> print + redirect </a>");
</script>

Open in new window

0
 
computerheavenAuthor Commented:
I just found out more information. If I remove the window.location, it will print. It just won't do both. But it will do both in FireFox with no problems.
0
 
computerheavenAuthor Commented:
Thanks! I had to modify it to fit my needs but that was the line of thinking I needed.
0
All Courses

From novice to tech pro — start learning today.