Reload browser window after POST without prompting user to resend POST data

Solution 1:

window.location.href = window.location.href;

Don't ask my why it works..but it does :).
Just the way the js engine interprets the logic I suppose.

Solution 2:

What you probably need to do is redirect the user after the POST / Form Handler script has been ran.

In PHP this is done like so...

<?php
// ... Handle $_POST data, maybe insert it into a database.
// Ok, $_POST data has been handled, redirect the user
header('Location:success.php');
die();
?>

... this should allow you to refresh the page without getting that "Send Data Again" warning.

You can even redirect to the same page (if that's what you're posting to) as the POST variables will not be sent in the headers (and thus not be there to re-POST on refresh)

Solution 3:

This works too:

window.location.href = window.location.pathname + window.location.search

Solution 4:

This worked for me.

window.location = window.location.pathname;

Tested on

  • Chrome 44.0.2403
  • IE edge
  • Firefox 39.0