OutFront Forums
     Home    Register     Search      Help      Login    

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

Sponsors
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

 

Help forcing a page to refresh onLoad

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> Help forcing a page to refresh onLoad
Page: [1]
 
jaberwocky

 

Posts: 185
Joined: 8/8/2003
Status: offline

 
Help forcing a page to refresh onLoad - 3/5/2004 15:36:50   
Is there any code i can use to force a page to refresh itself (no from cache) when the user opens it up? I have an Update.asp page where users can make changes to database and when they click submit i redirect them to a "confirmation" page that has 2 buttons on it, 1 they can click to get to the main menu, or 1 they can click to go back to the report page they were just using. I cannot send them directly back to that report page because to get there they had to select an 'employee' and it is this employees report they are view. So as a work around i am using a BACK button on my confirmation page and sending it 'back' 2 pages (history.go(-2)). Problem is when they go back to this page, the changes they have made dont show until they click on "REFRESH" on the browser.
I have search google and found a few things, but they dont work...namely
<script> 
window.onload = function() 
{ 
if (!window.location.search) 
{ 
setTimeout("window.location+='?refreshed';", .1000); 
} 
} 
</script>
also i found
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"><META HTTP-EQUIV="Expires" CONTENT="-1"> inbetween your <head></head> 
but this too does not work. i think the problem is cause i am just sending the user BACK, but i want the page to reload and refresh

any thoughts?
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Help forcing a page to refresh onLoad - 3/5/2004 15:58:45   
I've never been able to get it to work like that as well. I use hidden fields or querystrings to force the refresh. For instance, instead of your back button being a JavaScript:history type thing, use something like this instead:

<a href="myResultsPage.asp?EmployeeID=<%=Request("EmployeeID")%>">Back</a>

That works quite well for me...hope it helps you.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to jaberwocky)
jaberwocky

 

Posts: 185
Joined: 8/8/2003
Status: offline

 
RE: Help forcing a page to refresh onLoad - 3/5/2004 15:58:58   
OK.. well i found something that works..yayyyyyyyyy and i cant seem to figure out how to delete my post, so here is the solution i found:

create an asp called 'no_cache.asp'
<%
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
Response.CacheControl = "no-cache" 
Response.AddHeader "Pragma", "no-cache" 
Response.Expires = -1 
Response.Write "<script language='JavaScript'>"
Response.Write "window.status=' '"
Response.Write "</script>"
%>

then put at the top of my page i want refreshed
<!-- #include file="no_cache.asp" -->

it works

(in reply to jaberwocky)
jaberwocky

 

Posts: 185
Joined: 8/8/2003
Status: offline

 
RE: Help forcing a page to refresh onLoad - 3/5/2004 16:00:07   
hey rdouglas, did you see my response? It went on about 3/4 of a second after you posted yours LOL

(in reply to jaberwocky)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Help forcing a page to refresh onLoad - 3/5/2004 16:08:15   
LOL - close, huh?

But just a Q... does that not force a dialogue box in your browser? ...or does it just refresh automatically?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to jaberwocky)
jaberwocky

 

Posts: 185
Joined: 8/8/2003
Status: offline

 
RE: Help forcing a page to refresh onLoad - 3/5/2004 16:56:34   
nope no dialog box. it just refreshed the page with my updated data

(in reply to rdouglass)
higgy2k4

 

Posts: 1
Joined: 3/16/2004
Status: offline

 
RE: Help forcing a page to refresh onLoad - 3/16/2004 19:30:29   
Not sure if anyone else has tried this but it works for me.
I just changed the pages that you want to refresh everytime a user opens the page from the .htm frontpage give's it to .shtml
This works good for news pages and upcoming events things like that.
This is also good if you are constantly changing and updating your sites.
That way the changes are noticed the next time the user's open that page.

After reading the thread again I noticed you are working with ASP pages.
Not sure if this would even be an option for you.

< Message edited by higgy2k4 -- 3/16/2004 19:48:14 >

(in reply to jaberwocky)
SerenityNet

 

Posts: 1387
Joined: 6/12/2001
From: Allen, TX, USA
Status: offline

 
RE: Help forcing a page to refresh onLoad - 3/17/2004 0:11:58   
In my experience (although I must confess it's been over 6 months since I've fooled with any of this), I never had consistent luck with the history options. Also, older browsers and site's served up by an ISP's cache didn't always honor the meta tags, however creatively I presented them. But the following strategy did work.
  • Have the page look for a session variable. Say you call it "NewVisit", which (obviously) will have no value initially.
  • Make a little asp if statement in the page with something like: if NewVisit equals nothing, then make NewVisit equal one and refresh the page, else do nothing.

    Be sure to set NewVisit to a value before your refresh or you will create a loop.


    PS. I was just re-reading my post. Instead of saying "refresh" I should have said that I used     Response.Redirect ("samepage.asp");     or     Server.Transfer ("samepage.asp"); (if your service supports it).

    < Message edited by SerenityNet -- 3/17/2004 23:20:05 >


    _____________________________

    </Chaos, panic, & disorder - my work here is done.>

    (in reply to higgy2k4)
  • evansforsyth

     

    Posts: 277
    Joined: 12/11/2001
    From: Grande Prairie, Alberta, Canada
    Status: offline

     
    RE: Help forcing a page to refresh onLoad - 1/13/2008 19:44:33   
    This worked like a charm!

    <%
    Response.Expires = 0
    Response.ExpiresAbsolute = Now() - 1
    Response.AddHeader "Cache-Control", "must-revalidate"
    Response.AddHeader "Cache-Control", "no-cache"
    %>

    Just add it to the top of the code--above the HTML!

    (in reply to SerenityNet)
    Page:   [1]

    All Forums >> Web Development >> ASP, PHP, and Database >> Help forcing a page to refresh onLoad
    Page: [1]
    Jump to: 1





    New Messages No New Messages
    Hot Topic w/ New Messages Hot Topic w/o New Messages
    Locked w/ New Messages Locked w/o New Messages
     Post New Thread
     Reply to Message
     Post New Poll
     Submit Vote
     Delete My Own Post
     Delete My Own Thread
     Rate Posts