To prevent Browser caches for window.open
- IF you close and open the browser, it would work fine, however to programtically prevent this, pass in the URL so that it contains a unique element as below:
function openCustomConfirm()
{
var randomTime = (new Date).getTime();
if (confirm("Do you want to view your details"))
{
window.open('/MyServer/PersonServletDispatcher?functionName=View&time='+randomTime,'_parent');
}
}
- 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())
No comments:
Post a Comment