Results 1 to 7 of 7
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Force Browser Refresh

    I'm working on a project that involves outputting PDF directly to the screen and it works! but only if I remember to hit the 'refresh' button. how does one make the page do this automatically?

    I know there' s simple stuff like using META tag for refresh and javascript <font face="Georgia">document.location.reload(true);</font face=georgia> but those aren't working for my set up.

    the odder thing about what I am doing is, the PDF is generated in Memory and displayed to the browser directly as a binary image, so there's not a URL to reference, which means the META tag solution (from what I can tell) won't work.

    I also have s sneaking suspicion that no matter what I do some browsers, because of settings, will not listen to some javascript code that tells it to refresh.

    However, perhaps I am wrong on that <img src=/S/clown.gif border=0 alt=clown width=15 height=15>

    Anyhoo, does anyway have a quick solution? I'm thinking some kind of javascript that kicks in after OnLoad() or some such.

    I'll keep poking around, but thought I'd give the loungers a try.

    TIA
    <img src=/S/compute.gif border=0 alt=compute width=40 height=20>

  2. #2
    2 Star Lounger
    Join Date
    Sep 2003
    Location
    Juneau, Alaska, USA
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force Browser Refresh

    Some browsers don't have javascript enabled-so your sneaking suspicion is certainly correct.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force Browser Refresh

    that's not an issue - the pages i am working on are for people in my area so I will be able to demand, force, and foist javascript on them.

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Force Browser Refresh

    Can you use window.setTimeout() ? It is one that is abused, so will not fire under many pop-up blockers...

    On second thought: if the image resides in memory, and you refresh the page, don't you lose the image? This is not making a great deal of sense to me.

  5. #5
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Coppell, Texas, USA
    Posts
    168
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force Browser Refresh

    I'm coming in a little late, and I'm not sure if you're running into this issue, but with generated web content, IE can be a pain. It has a habit of using its cache even when you tell it not to. But to make sure we're tackling the right issue, can you answer a couple questions:

    1) What are you using to generate the binary image for the PDF (is it done with ASP, JSP, Java Servlet, DLL, etc.)?

    2) What's the URL to access the script or app that creates the PDF in memory?

    3) What happens if you change the browser's cache setting (Tools > Internet Options > Temporary Internet Files > Settings > Check for newer version of web pages = Every visit to the page)?

    4) Are you setting the content type header in the response that sends the PDF? Expiration? No-cache?

    Knowing this stuff helps narrow down the problem and getting the right solution.

    Thanks

  6. #6
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force Browser Refresh

    since posting my question, I accidentally deleted the entire directory for the project I was working on and have had to re-write it, and in the course of doing so have implemented things differently so the whole issue of forcing the browser to refresh no longer applies.

    FYI, I am using a server object called ActivePDF Toolkit that allows you to create PDFs on the fly or populate a PDF template with data from a db and lots of other things. My first shot at making it work used some code that creates a new unique file each time a PDF is generated; I switched to generating the PDF in memory and that's when the Refresh issue came up.

    Now I'm just overwriting the output file and displaying it using response.redirect, which works just fine.

    Thanks for your suggestions, but IMHO certain things (like depending on predictable caching behaviour from a browser) are just asking for trouble. I was always sceptical that a particular technique for refreshing the browser would work cross-platform.

    OTOH, I don't even know *why* I was having the problem I was having: 1. create the pdf in memory and 2. output to the browser using application:x-pdf (or however the content type header is specified).... in IE nothing happens unless you hit F5 and then the in-memory generated PDF shows up. weird. My current method makes more sense to me.

    anyway, thanks for replying.

  7. #7
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Coppell, Texas, USA
    Posts
    168
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Force Browser Refresh

    Well, deleting the project is one way to go. A bit extreme. ; -)

    I don't think it's so much forcing refresh as much as forcing IE not to read it's cache. In some cases we've had to add a querystring with timestamp parameter to force IE to actually get the file instead of reading it back from memory.

    Hopefully overwriting the output works without any new snags.

    Good luck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •