Making pages automatically refresh

Discussion in 'Programming' started by DerkThunder, Dec 26, 2007.

  1. #1
    I have a site where I update the content every day. However, not all of my returning visitors hit the refresh when they come back and are thus stuck with the old content, think it wasn't updated, then leave and don't come back. I do every thing I can to make sure my visitors know to refresh when visiting my site but there are still some who don't.

    Does anyone know of any kind of code I can put in my page that tells their browser to refresh the page every time it's loaded?
     
    DerkThunder, Dec 26, 2007 IP
  2. shoeshine

    shoeshine Peon

    Messages:
    250
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Are you using custom code in your website? Because the problem that you have is content caching.
     
    shoeshine, Dec 26, 2007 IP
  3. DerkThunder

    DerkThunder Well-Known Member

    Messages:
    373
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    108
    #3
    As far as custom code not really. My site is straight HTML, no PHP. I do have code for stats tracking and and the alexa traffic box though.
     
    DerkThunder, Dec 26, 2007 IP
  4. Muzammal786

    Muzammal786 Banned

    Messages:
    663
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You are using HTML static code. Use PHP or ASP to make it dynamic site. You have to convert your website in dynamic. You should make a database from where contents will be automatically updated when you need to only store fresh content into the database.

    Hope you have understand it.
     
    Muzammal786, Dec 26, 2007 IP
  5. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #5
    <?

    header("Expires: Mon, 26 Jul 1995 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    ?>

    use this in php file

    When ever they come on site they will see fresh page

    Regards

    Alex
     
    kmap, Dec 26, 2007 IP
  6. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #6
    No need to go through the trouble of using dynamic pages if you only running HTML, use meta tags:

    
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
    
    Code (markup):
    Peace,
     
    Barti1987, Dec 26, 2007 IP