Does confirm form resubmission dialog pops up in Chrome when you press the reload button while submitting data. It also occurs when you refresh Chrome and also after pressing a back button.
However, after extensive research and exposure of this feature, it has come out to be one with a few glitches and mishaps. The dialogue box has begun popping up after refreshing pages that never even contained any form in them, to start with. It is still present in all the versions of Chrome and many other browsers.
According to a Super User poster, Chrome introduced this ?feature? to prevent browsers from accidentally duplicating POST actions on forms.
But Why does this happens?
- No proper Internet connection.
- A page that contains a certain kind of form has refreshed.
- In the middle of a form being submitted; you try to click on the back button.
For example, buying the same item twice. If you refresh a page after buying something, your credit card could be charged twice if you weren?t asked to ?confirm form resubmission.?Many Chrome users complained about this bug reports; this issue has remained persistent.
The SuperUser poster says, is that the Chrome module that does back/forward is built so weakly that it is impossible to fix.
How to Turn off Confirm Form Resubmission Error?
The following are the methods by which Confirm Form Resubmission error of Chrome can be resolved.
Method #1 Check Your Internet Connection
The silliest reason for this pop-up might be that your internet data connection is very poor. Try to turn it off for once and restart again and check if the problem is still here or not.
Method #2 Reset Chrome Browser Settings
Resetting the browser settings is very similar to clearing your browsing data. It permits the browser to go back to its default way of functioning, disregarding any changes that may have been manually introduced by the user. Here is how you can reset them:
Step 1: Open Chrome and click on the three vertical dots placed on the upper right corner of the webpage.
Step 2: Click on ?Settings? from the drop-down menu.
Step 3: Scroll until you come across the option that says ?Show Advanced Settings.?
Step 4: Once again, scroll ahead till you find the option ?Restore settings to their original defaults? and click on it.
Step 5: Lastly, click on ?Reset Settings? before exiting. Reload Chrome to see if this has made a difference.
Method #3 Disable Corrupted Extensions
Chrome extensions get corrupted all the time. Simply disabling and re-enabling the extensions could be the answer to your issue.
For doing so, go through the following steps.
Step 1: Open Chrome and click on the three vertical dots placed on the upper right corner of the webpage.
Step 2: Click on ?More Tools? and select the option that says ?Extensions.?
Step 3: Navigate and find the corrupt extension. Disable and then re-enable it
Step 4: Finally, restart Chrome to see if the dialogue continues to pop up.
Here, all the extensions you have on the browser will disable for once and then re-enable all as per requirement. After doing so, try and recheck the page to see if the error has solved or not.
Method #4 Use the PRG Pattern
PRG stands for the POST/Redirect/GET pattern. As stated before, the ideal method for storing content in online forms should be using the PRG pattern. What can pass as a solution to rectifying the Confirm Form Resubmission error is switching the POST method to the entire PRG pattern. Whenever any page needs a form on it, design it in such a way that it does not post the data directly to the server. Instead, try to add one page between that page and the actual page after it.
It should have to go through more than one step, so that the ultimate mechanism would change to GET rather than POST, thus restricting the dialogue box from appearing. Therefore, there won?t be a Confirm Form Resubmission dialog pop-up on refreshing the page accidentally.Example of this offered by Mike from Stack Overflow:
if(!empty($_POST[?username?] && !empty($_POST[?password?])) {
$user = new User;
$user->login($_POST[?username?], $_POST[?password?]);
if ($user->isLoggedIn()) {
header(?Location: /admin/welcome.php?);
exit;
}
else {
header(?Location: /login.php?invalid_login?);
}
}
if (isset($_GET[?invalid_login?])) {
echo ?Your username and password combination is invalid?;
}
to display an error message in case the Username and Password combination didn?t match and don?t want to redirect them to the Login page again as it does in the first case.
Method #5 Using AJAX Submit Button
Try using the AJAX function of jQuery once the form has been submitted. In order to do this, simply add the following function to your page?s code:
Step 1:
$.ajax({
type: ?POST,?
URL: ?bin/validation.php.?
data: datastring,
success: function(){
//Whatever you want to do on successful submission
}
});
return false;
The data entered in the form as per the PHP file provided as the URL property AND if the data validated it implies that it was a successful submission of the form data and thus it returns false so that even if the page is reloaded, it doesn?t send a new request and so there would not be any Confirm Form Resubmission dialog popping up.
Method #6 Adding a Tag Inside <head> Part
It is a method you can try out if the error occurs when you manually refresh the web page. If you can get access to the source code of the web page, add the following tag to the <head> section of the page. To go about doing this, follow the given steps:
Step 1: Access the source code of the web page.
Step 2: Add the following tag to the <head> section of the web page. The extension may differ depending on the one you are using:
<meta http-equiv=?refresh? content=?60;
write_the_url_of_the_page_to_be_tested_over_here.html? />
Method #7 Delete no-store
If your form uses the following Header, then the origin of the error is likely to lie here.
header(?Cache-Control: no-store, no-cache, must-revalidate, max-age=0?);
Follow the given steps:
Step 1: delete the words ?no-store? from the header.
Step 2: Now, refresh the page within the form.
Step 3: Lastly, re-enter the form and refresh it to see if the pop up still appears.
Conclusion
The Confirm Form Resubmission error is one that has been reported by the way too many people in the past, and it is completely understandable why it might cause frustration among users. If you are someone solutions to the error, you have come to the right place.
The provided methods may not always serve as permanent ones, but can definitely rid you of the error for short periods of time. But yes, the problem is not bigger than these 7 methods. You will surely get the solution.