ashwanichauhan1
December 2nd, 2002, 05:16 AM
Whenever i try to access a site it shows a message
"Action cancelled". this is happening whenever i click on any of link in the site. I am able to see the page only when i refresh everytime. I have cleared the cache.
Also when i logout and login as a different user the browser shows the details of the previous user. Please help?
Regards
Ashwani
websmith99
December 2nd, 2002, 05:24 PM
For the "Action canceled" issue - what happens when you use Netscape 4.x or Netscape 6.x?
As for the logging out and logging in as a different user, and still seeing the data for the previous user, this is client side caching of the pages. To combat client side caching, append a query string variable with a random number as it's value to the URL. Because the URL to a given page will be unique each time, it can't be cached.
<script language="JavaScript" type="text/javascript">
random.m = 714025;
random.a = 4096;
random.c = 150889;
random.seed = (new Date()).getTime() % random.m;
function random() {
random.seed = (random.seed * random.a + random.c) % random.m;
return Math.round((random.seed / random.m) * 1000);
// This will generate a random integer between 0 and 1000. If you
// want to increase the range to between 0 and x, replace the
// "1000" in the above line with "x"
}
</script>
...
<body>
<script language="JavaScript" type="text/javascript">
nexturl = "/page2.jsp?foo=" + random();
</script>
<a href="#" onclick="window.location=nexturl; return false">page 2</a>