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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Umar Topia.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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
computerheavenAuthor Commented:
Thanks! I had to modify it to fit my needs but that was the line of thinking I needed.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.