I'm working on a few asp pages that dynamically create a PDF file and
load that PDF file in a new window in the browser. There's a problem with
the browser's cache though, it doesn't check the date/time from the cached
file when opened in a new window, it just loads what's in the cache. I
previously alleviated this problem by using the following JavaScript code:
<script language="JavaScript">
var newWin
window.open("","PDF","width="+(screen.availWidth-10)+",height="+(screen.avai
lHeight-30)+",top=0,left=0");
newWin.location.replace('/print/pdf/output/<%=sPDFResult%>')
</script>
This was working fine, until we tested it on an NT 4.0 Client with Internet
Explorer 4.0, 5.0 or 5.5. On these machines, it was still reloading the
page from cache. So, I added the following code:
<script language="JavaScript">
var newWin
window.open("","PDF","width="+(screen.availWidth-10)+",height="+(screen.avai
lHeight-30)+",top=0,left=0");
newWin.location.replace('/print/pdf/output/<%=sPDFResult%>')
newWin.history.go(0);
</script>
I added the "newWin.history.go(0);" so it would refresh the page
automatically and not use the page in the cache. This worked great for NT
4.0 with IE 4.0 and 5.0, but on IE 5.5, it brought up a blank page. I think
it's doing the refresh before it does the location.replace command, thus
refreshing the blank page that was opened. I tried changing it so the
window.open directly calls the pdf file, then doing the refresh, but that
doesn't work either, still brings up the old page from the cache.
I've also tried creating an .asp page that gets called in window.open with a
querystring parameter of the pdf filename, then doing a JavaScript
location.replace to that filename, but it still loads the old file from the
cache...
Does anybody have any ideas on this one? I'm stumped...
Thanks!
Shawn Steward
Applied Systems, Inc.