• Resolved rnv77

    (@rnv77)


    Hi!

    Is it possible to somehow reload the page as soon as the age verification was successful? We have a page with an automatic animation starting that should start as soon as the age verification is done (and not behind it). Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Phil

    (@philsbury)

    Hi @rnv77,

    If you’re using the JS version (which it sounds like you are), then there’s a js event fired on success: agegatepassed.

    You could use that to either trigger a reload, or just restart the animation if its on a timeline.

    Cheers
    Phil

    Thread Starter rnv77

    (@rnv77)

    Hi! Thanks for your quick response. Could you please help me a step further? I found the part where the agegatepassed is triggered but could you tell me how I add a reload to it? Thanks again!

    Plugin Author Phil

    (@philsbury)

    Hi @rnv77,

    You can add this to your functions.php and it should work:

    add_action('wp_footer', function () {
        ?>
        <script>
          window.addEventListener('agegatepassed', function() {
            window.location.reload();
          });
        </script>
      <?php
    });

    if you’ve got a custom JS file you can use, it might be better, can just add the content from inside the <script> above. But the above should work

    Cheers
    Phil

    Thread Starter rnv77

    (@rnv77)

    Amazing, thanks!

    Thread Starter rnv77

    (@rnv77)

    Hi @philsbury!

    One short question not related to this topic: My customer wanted me to add the autofocus attribute to the input fields which I did by modifying the plugin could. Do you consider to integrate this feature in a future version? I think it’s a really nice enhancement to the UX. Thank you!

    Best,
    Robin

    Plugin Author Phil

    (@philsbury)

    Hi @rnv77,

    Yes – kind of. In the next big release (v3) there’ll be a function to add attributes to most things, so that should be possible easily then.

    Thanks
    Phil

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Page reload after successful submit’ is closed to new replies.