Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FAQ Topic - How do I force a reload from the server/prevent caching? (2010-09-06)

0 views
Skip to first unread message

FAQ server

unread,
Sep 5, 2010, 7:00:04 PM9/5/10
to
-----------------------------------------------------------------------
FAQ Topic - How do I force a reload from the server/prevent
caching?
-----------------------------------------------------------------------

To reload a page, use `location.reload()`. However, this depends
upon the cache headers that your server sends. To change this,
you need to alter the server configuration. A quick fix on the
client is to change the page URI so that it contains a unique
element, such as the current time. For example:
`location.replace(location.href+'?d='+new Date().valueOf())`
If the `location.href` already contains a query String, use:
`location.replace(location.href+'&d='+new Date().valueOf())`

<URL: http://www.mnot.net/cache_docs/>
<URL: http://docs.sun.com/source/816-6408-10/date.htm>


The complete comp.lang.javascript FAQ is at
http://jibbering.com/faq/

--

The sendings of these daily posts are proficiently hosted
by http://www.pair.com.

0 new messages