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
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    can u force "clear cache"

    hello,

    is there a ay that I can force someones browser to automatically reload when they visit a site? this is the problem: when someone tries to view a site, they are not seeing the most recent changes.. i figure there is proabably some sort of code that i can use to "force" there browser to automatically reload so they are always seeing the most current version of the site....

    thanks for all you help! everyone here has been very helpful in the past...

  • #2
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In your <head>:
    Code:
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    Good luck.
    Moderator @ WebDeveloper.com
    Mentor @ WebXpertz.net

  • #3
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Honestly, I'm not completely convinced this script works.
    Therefore, I could use yours and others testing and input.

    What it does is append the UTC time as a querry to your URL
    My theory is this should be another unique URL and therefore
    not cached.

    Input invited.

    <script type="text/javascript">
    <!--
    function reloadIt() {
    var clocktime = new Date();
    var utchours = clocktime.getUTCHours();
    var utcminutes = clocktime.getUTCMinutes();
    var utcseconds = clocktime.getUTCSeconds();
    var utcyear = clocktime.getUTCFullYear();
    var utcmonth = clocktime.getUTCMonth()+1;
    var utcday = clocktime.getUTCDate();

    if (utchours <10) { utchours = "0" + utchours }
    if (utcminutes <10) { utcminutes = "0" + utcminutes }
    if (utcseconds <10) { utcseconds = "0" + utcseconds }
    if (utcmonth <10) { utcmonth = "0" + utcmonth }
    if (utcday <10) { utcday = "0" + utcday }

    var utctime = utcyear + utcmonth + utcday;
    utctime += utchours + utcminutes + utcseconds;
    x = utctime

    isNew = self.location.href
    if(!isNew.match('#','x')) {
    self.location.replace(isNew + '#' + x)
    }
    }

    //-->
    </script>

    </head>
    <body onLoad="reloadIt()">


    .....Willy


  •  

    Posting Permissions

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