Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh on load and refresh button problems 2

Status
Not open for further replies.

LEICJDN1

Technical User
Nov 27, 2002
201
GB
Hello,

I have an ASP page which is opened by a link, and pulls in some database data. However, if it is closed then re-opened it requires a forced refresh to update the data.

Question1: How can I foce the page to refresh itself whenever it is opened.

Question2: I would like to add a button which the user can click to refresh the page if they decide to leave the page open and come back to it another time.

I tried this code but it doesn't seem to work:

In the body section -

<script type=&quot;javascript&quot;>
function refreshPage(){
thisPage = document.location.href
document.location = thisPage
}
</script>

The button:

<input type=&quot;button&quot; class=&quot;markbutton&quot; onclick=&quot;refreshPage()&quot; value=&quot;Refresh&quot; />

All help and advice much appreciated as always.

JDN
 
for refreshing a page try this:
document.reload() //if that doesnt work then its window.reload()

and the other thing is a cache problem, ur browser always stores a copy of ur ASP page to the local machine u have to clear the cache, do a search in this forum for &quot;headers&quot; and &quot;cache&quot;...

Known is handfull, Unknown is worldfull
 
hi
u can try it
<script type=&quot;javascript&quot;>
function refreshPage(){
thisPage = document.location.href
document.location.href = thisPage
}
</script>

or

<script type=&quot;javascript&quot;>
function refreshPage(){
window.location.reload();
}
</script>
 
Location reload worked a treat.

Also found the uURL=date hack for ensuring no cacheing of pages.

Both questions solved.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top