Setting a Webflow page to automatically refresh once Answered

Hey! Is there a way I can get a page in webflow to automatically refresh when the user is redirected there from the payments page because I have some content that is shown depending on whether or not the user is has a pro account. The feature works fine after I refresh manually, but I am wondering if there is any way I can do it automatically

Comments

2 comments

  • Comment author
    Julian Galluzzo

    Yes you can! A simple refresh script works, but it could get a bit trickier because you dont want to create an endless refresh loop! I'll try something for you

    Preston Button put this script in the </body> section of the page:

    <script>
      document.addEventListener("DOMContentLoaded", function() {
        const isReloaded = localStorage.getItem("pageReloaded");
    
        if (!isReloaded) {
          localStorage.setItem("pageReloaded", "true");
          location.reload();
        } else {
          localStorage.removeItem("pageReloaded");
        }
      });
    </script>
    0
  • Comment author
    Preston Button

    thanks a lot

    0

Please sign in to leave a comment.