Re: AJAX html won't refresh after data update



On Oct 6, 4:32 am, Randy Webb <HikksNotAtH...@xxxxxxx> wrote:
Thomas 'PointedEars' Lahn said the following on 10/5/2007 7:41 PM:
Randy Webb wrote:
Thomas 'PointedEars' Lahn said the following on 10/5/2007 2:00 PM:
c...@xxxxxxxxxxxx wrote:
On Oct 4, 9:52 am, Robin <a...@xxxxxxxxxxxxx> wrote:
Add a 'unique' variable to the query string of you ajax URI so that
browser doesn't use the cached copy.
i.e.
obj.open('GET','ajax_call.php?recid='+recid+'&z='+
new Date().getTime(),true);
Dang, Robin! That actually works! Not used to getting such good help
the first time around :D

Thanks for the great idea.
That idea is BAD because it fills the browser cache with garbage, and so
eventually slows down access to other content. Unnecessarily.
Pure nonsense.

(sic!)

It isn't nonsense, it's a fact. (Or have I overlooked your argument by any
chance?)

You have overlooked the argument. There is a very good reason for using
a query string to force a reload from the server. And no, headers and
server settings won't satisfy the need.

I have followed this post with interest as I have experienced some
strange exceptions to the "IE caches the results of HTTP GET requests"-
rule. I have not found a concise pattern in my findings yet, but I can
conclude that IE's internal caching-strategy "agent" is more complex
than can be listed in a small set of rules. I think that IE has a
large set of rules (including some state-dependencies) for determining
whether to fetch data from cache or to do a reload. In my current
simple test-environment I can reproduce the fact that the "Cache-
Control" and/or "Expires" headers definately have an effect on whether
data is fetched from cache or from a reload (in IE, that is).
Furthermore, IE's caching strategy seems to be dependant on the
requested document's extension, but I am not completely sure of this
statement yet. In any case, with my PHP (-extension) scripts, the
"Cache-Control" and "Expires" headers definately make a difference. On
the other hand, one could argue that setting the headers will not be a
good general solution in forcing reloads, because one also has to take
"forwards compatibility" into account. MS clearly states that the
"POST" method will "guarantee" a page reload, which simply translates
into a meaning that they reserve the right to change their GET-
oriented cache strategy in future versions of IE. I (regret to say
that I) agree with PointedEars that setting a unique variable to the
query string is a bad solution for forcing page reloads. But I am also
saying that I do not know a better alternative solution. If anyone is
still interested in this subject, just let me know and I will post the
code I used during testing.

.



Relevant Pages

  • Re: Forcing browsers not to use their cache for images
    ... The browser ignores the request string part of the URL and continues to reload the image from its cache. ...
    (comp.lang.javascript)
  • Re: Very poor browser cache options control
    ... When returning to a previously viewed page, via the Back or Forward Buttons, the browser cannot be set (using the Temporary Internet Files cache setting options in the Tools Menu) to always read from the cache rather than reloading the page from the site. ... I know there are instructions in some pages that instruct the browser to reload the page from the site, but when the browser is set to "Never Check for Newer Versions of Stored Pages", it should bypass those instructions and load only what has been cached, to speed up browsing. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Forcing browsers not to use their cache for images
    ... The browser ignores the request string part of the URL and continues to reload the image from its cache. ...
    (comp.lang.javascript)
  • Re: Forcing browsers not to use their cache for images
    ... You may tell the browser to request the file every time, but if the browser is set to only check once per session, I believe the browser wins and does exactly that. ... So you are saying that there is essentially no programmatic way of forcing browsers to reload an image from its URL rather than taking the image from its cache? ...
    (comp.lang.javascript)
  • Re: Squid Overkill? (Speed Up Web Surfing)
    ... Each user's browser already maintains a cache of web ... Squid cache. ... The first local user to access a web site on a distant web server will ...
    (comp.unix.bsd.freebsd.misc)