How do you prevent a form from resubmitting when the page is refreshed?

Use Javascript

This method is quite easy and blocks the pop up asking for form resubmission on refresh once the form is submitted. Just place this line of javascript code at the footer of your file and see the magic.

Code:  
    <script>  

        if ( window.history.replaceState ) {

          window.history.replaceState( null, null, window.location.href );

        }

    </script>



Comments

Popular posts from this blog

on_sent_ok not working in Contact Form 7 version 5.0.2

Sql useful quiries

Make carousel slider in shopify