Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    bdd
    bdd is offline
    New Coder
    Join Date
    Aug 2006
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Why cant I view my page updates?

    I have web-site, everytime I update the news or anything on the site like adding pictures or changing pictures via FTP and visit it in Firefox or INternetexplorer I have to hit Refresh to view the Updates. Why is this? Can I fix it so it shows updates everytime users visit?

  • #2
    New Coder
    Join Date
    Jun 2006
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is because once your browser downloads the page, it breaks contact with the server. Refreshing makes your browser download the pictures again, and then it gets the new version.

    To make your page update automatically, you may want to look into AJAX or the setInterval() function. e.g. The JS code setInterval("location.reload();",3000); would make your page refresh every 3 seconds; however, that updates the whole page, so your code will probably have to be a bit more complex, so you are updating only the images,news,etc.

    If it's news that needs updating, I would recommend AJAX.

  • #3
    Senior Coder
    Join Date
    Feb 2006
    Location
    USA
    Posts
    1,013
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I suggest you change the HTTP headers that control how browsers will cache your page instead of resorting to AJAX which would be overkill for this.
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions
    Java != JavaScript && JScript != JavaScript
    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.


  •  

    Posting Permissions

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