title: Browser: Prevent POST data resubmit on refresh using only JavaScript
body: <p>I am aware of the many Post/Redirect/Get questions on here. This one is a bit different. I'm unable to find an answer that explains this particular  JavaScript solution.</p>
  <p>When you submit a form via POST and then hit the refresh button afterwards, the browser will prompt me to re-submit data. <em>HOWEVER</em> this prompt does not happen in the WordPress backend (when JS is enabled) and there is no Redirect/Get after the Post.</p>
  <p>I've tried to show this in a series of screenshots below. It shows the first POST submit with the POST data printed on the page, and then the refresh causes a GET without any browser re-submit prompt.</p>
  <p><a href="https://i.stack.imgur.com/Ie60b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ie60b.png" alt="browser resubmit without post" /></a></p>
  <p>When I disable JavaScript and hit refresh, I get the expected &quot;Would you like to resubmit your data?&quot; prompt and the refresh causes a second POST.</p>
  <p><a href="https://i.stack.imgur.com/YIpVg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YIpVg.png" alt="js disabled, normal post resubmit happens" /></a></p>
  <p>So wordpress is doing some JavaScript magic here to prevent POST data resubmission on refresh/back button.</p>
  <p>Can anyone point me to the code in WordPress that shows how they achieve this using only JavaScript? I have no idea where to even start searching.</p>
  <p>Do they do something with the pushstate?</p>
  <p>Thanks!</p>