Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. New website not loading (old cache issue)

New website not loading (old cache issue)

Scheduled Pinned Locked Moved General Discussion
6 Posts 2 Posters 224 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    billykioso
    wrote on last edited by
    #1

    Does anyone know a simple way to fix this?

    I recently redesigned a website with LayTheme but visitors who had previously accessed it keep seeing a blank page when they type in the URL (new visitors see the new site fine). I assume it is to do with cache but is there a way to force the site to reload instead of asking people to clear cache and history?

    I read on a support forum that:

    "You can implement a PHP script that must be the first line of code in your index file . It is an http header typically issued by web servers. You can also rename the resource that is considered "stale".

    <?php Header("Cache-Control: max-age=3000, must-revalidate"); ?>

    But as I'm not a developer I'm a bit uneasy about pasting it into the LayTheme Custom CSS.

    If anyone knows the answer to this it would be very much appreciated!

    Thanks!

    1 Reply Last reply
    0
    • RichardR Offline
      RichardR Offline
      Richard
      Global Moderator
      wrote on last edited by
      #2

      Dear @billykioso

      Sorry for the delay,
      Have you come to any solution since posting?

      Best wishes
      Richard

      1 Reply Last reply
      0
      • B Offline
        B Offline
        billykioso
        wrote on last edited by
        #3

        Thank you Richard, no it still persists.
        Do you know if there is a simple fix to this? (I don't even know if the PHP thing I posted is relevant).
        The website I'm having trouble with is http://studiosyn.co.uk

        1 Reply Last reply
        0
        • RichardR Offline
          RichardR Offline
          Richard
          Global Moderator
          wrote on last edited by
          #4

          Dear @billykioso

          Sorry for the delay:
          Have you looked into this simple line of code?

          https://stackoverflow.com/questions/6985507/one-time-page-refresh-after-first-page-load

          I think it will achieve your needs :)

          Best
          Richard

          B 1 Reply Last reply
          0
          • RichardR Richard

            Dear @billykioso

            Sorry for the delay:
            Have you looked into this simple line of code?

            https://stackoverflow.com/questions/6985507/one-time-page-refresh-after-first-page-load

            I think it will achieve your needs :)

            Best
            Richard

            B Offline
            B Offline
            billykioso
            wrote on last edited by
            #5

            @Richard thank you, I used the code in HTML at top:

            // Reload Page Function //
            // get the time parameter //
            let parameter = new URLSearchParams(window.location.search);
            let time = parameter.get("time");
            console.log(time)//1
            let timeId;
            if (time == 1) {
            // reload the page after 0 ms //
            timeId = setTimeout(() => {
            window.location.reload();//
            }, 0);
            // change the time parameter to 0 //
            let currentUrl = new URL(window.location.href);
            let param = new URLSearchParams(currentUrl.search);
            param.set("time", 0);
            // replace the time parameter in url to 0; now it is 0 not 1 //
            window.history.replaceState({}, "", ${currentUrl.pathname}?${param});
            // cancel the setTimeout function after 0 ms //
            let currentTime = Date.now();
            if (Date.now() - currentTime > 0) {
            clearTimeout(timeId);
            }
            }

            ...but it comes out like this. Have I done something wrong?

            Screenshot 2021-04-13 at 11.31.45.png

            1 Reply Last reply
            0
            • RichardR Offline
              RichardR Offline
              Richard
              Global Moderator
              wrote on last edited by
              #6

              Dear @billykioso

              Cool :)

              Javascript must be wrapped in <script> tags for your browser to recognise it as <script>

              <script>
              
              // insert code in between opening and closing brackets
              
              </script>
              

              Also please refer to this documentation page about using JS with Laytheme & attention to the 'newpageevent'

              https://laytheme.com/documentation.html#custom-javascript

              Likely you will want to add your custom code into:

              Lay Options > Custom <head> Content

              Best wishes and good luck @billykioso !

              Richard

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              I also code custom websites or custom Lay features.
              šŸ’æ Email me here: šŸ’æ
              info@laytheme.com

              Before you post:
              1. When using a WordPress Cache plugin, disable it or clear your cache.
              2. Update Lay Theme and all Lay Theme Addons
              3. Disable all Plugins
              4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

              This often solves issues you might run into

              When you post:
              1. Post a link to where the problem is
              2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
              3. If the problem is difficult to explain, post screenshots / link to a video to explain it
              Online Users
              Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
              laytheme.com
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Recent
              • Tags
              • Popular
              • Users
              • Search