manne
asked on
backbutton asp reload
If I use the back button the page doesn't run the asp instead it used the cache. It works good with ie4sp1. Anyone who have solved this one?
---
3 asp pages
<%
response.expires=0 'makes it works with ie4sp1
Session("kalle")=1
response.write Session("kalle")
%>
<p><a href="two.asp">cont</a></p >
---
<%
response.expires=0
Session("kalle")=Session(" kalle")+1
response.write Session("kalle")
%>
<p><a href="tre.asp">cont</a></p >
---
<%
response.expires=0
Session("kalle")=Session(" kalle")+1
response.write Session("kalle")
%>
---
3 asp pages
<%
response.expires=0 'makes it works with ie4sp1
Session("kalle")=1
response.write Session("kalle")
%>
<p><a href="two.asp">cont</a></p
---
<%
response.expires=0
Session("kalle")=Session("
response.write Session("kalle")
%>
<p><a href="tre.asp">cont</a></p
---
<%
response.expires=0
Session("kalle")=Session("
response.write Session("kalle")
%>
ASKER
doesn't the backbutton have a event where you can place location.reload()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Manne,
I don't know if you realize it, but I am really proud of the code I showed you. Mainly because it works, and I did not think it would be possible to make a thing like that work.
I don't know if you realize it, but I am really proud of the code I showed you. Mainly because it works, and I did not think it would be possible to make a thing like that work.
- While loading, ASP writes the time to a JS-variable.
- Another JS-variable is set to the current date/time
- Both are compared, and when the difference is bigger then say 10 seconds, the page is forced to reload by Javascript.
The trick is that when the backbutton is used, and the page comes from the cache, so the ASP-set JS variable is old.
However, the JS-variable which is set to current date/time refreshes even when the backbutton is used.
code would be something like this:
<script language="Javascript">
<%
tmLoaded = Now()
Response.write "tmLoaded = new Date(...date/time based on tmLoaded);" & CHR(10)
%>
tmDisplayed = new Date();
if (tmLoaded-tmDisplayed > 10) {document.reload();}
</script>