Recently I was asked to display one of these PDFs in a separate window. Pretty simple task right? I wrote a little bit of Javascript with some window.open goodness and tested it out in IE7 (our standard). Blank page. Crap.
Turns out with a little bit of searching, IE7 and Adobe Reader don't play nice together when opening up a PDF in a new window created by Javascript. Many people had the issue with the most common resolution to just create a link with a blank target. That didn't quite suit my needs. So here's my resolution.
The window.open command can take in an optional URL. Instead of putting the URL of the PDF in the original window.open command I did something similar to the following:
var childWin = window.open('', 'windowname', 'other options');
childWin.location.replace('url of PDF');
By opening up the window with a blank page and then immediately doing a location.replace on the child window I was able to successfully bring up the PDF.
Hope that helps!
Very helpful ;-)
ReplyDeleteThnx