When a user visits my website there is a \"Login\" link on every page. Clicking this uses some JavaScript to show an overlay window where the user is prompted for their cred
This can be solved also with POST/REDIRECT/GET pattern.
Which is more elegant:
How do I reload a page without a POSTDATA warning in Javascript?
This worked for me.
window.location = window.location.pathname;
Tested on
When we want to refresh the parent page from the child page without any prompt.
Here is the code:
window.opener.location.href = window.opener.location;
This simply refreshes the parent page without any prompt.
This is an older post, but I do have a better solution. Create a form containing all of your post values as hidden fields and give the form a name such as:
<form name="RefreshForm" method="post" action="http://yoursite/yourscript">
<input type="hidden" name="postVariable" value="PostData">
</form>
Then all you need to do in your setTimeout
is RefreshForm.submit();
Cheers!
To reload opener window with all parameters (not all be sent with window.location.href method and method with form.submit() is maybe one step to late) i prefer to use window.history method.
window.opener.history.go(0);
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)