SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast Bloobird's Avatar
    Join Date
    Jan 2005
    Location
    Wales UK
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Automatic Refresh

    Ive got a page which for some reason needs to be refreshed before anything updates. Its a php page with mysql data on it.

    At the moment ive got a script which refreshes it every few seconds, but when the user scrolls to the bottom of the page they are taken back to the top when it refreshes!

    Is there a way i can make it refresh once as soon as the user comes to the page? as opposed to putting a timer which refreshes every X amount of seconds?

    Any help would be great!

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is there a way i can make it refresh once as soon as the user comes to the page?
    You need to rethink your design. The main obstacle to fast web pages is having to go back to access the server and wait for data. Javascript is useful because it can do things without the need to go to the server, so it's fast. But, you are saying that for anyone that accesses your page, you are going to make the user wait for the page to load twice? You might as well just make your page blank--people are going to leave your site immediately anyway.

  3. #3
    SitePoint Enthusiast Bloobird's Avatar
    Join Date
    Jan 2005
    Location
    Wales UK
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yea I see what you are getting at.
    But its a stock control system on an intranet. And its only one page that needs to refresh. (the current stock level page).

  4. #4
    SitePoint Addict dek's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why can't you simply disable caching of the page?

    Examples of how to do that in PHP can be found here

    If you still need to refresh it periodically, one option is to use Javascript to preserve the window's current scroll position & restore it on page load. It's still a little clunky, but marginally less so than jumping to the top each time.
    Only dead fish go with the flow

  5. #5
    SitePoint Enthusiast Bloobird's Avatar
    Join Date
    Jan 2005
    Location
    Wales UK
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks!
    I will look into both!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •