Approach 1 is a fairly simple method that solves some recurring message problems. It will not cope with server latency and is the reason for duplication of feed.
Approach 2 is nothing but the wrong. Users will be upset if they restrict standard browser features, such as updating. That is, if you can even make a technically cross browser. You need to consider F5, Ctrl + F5, â + F5, etc., Various refresh icons.
I have to admit that I do not fully understand the purpose of approach 3, however, it is a bit erroneous to drop the user onto a blank page.
Another standard approach is to use nounce with form posts. It will also help avoid a security risk called the Cross Site Search Request Subroutine . It is pretty simple.
- Create a "unique" random string on the server called nonce.
- Insert nonce into the database.
- Attach nonce to the form as a hidden field (or go to a URL or similar).
- Verify that the nonce message is sent in the form message to the server.
- On the server side, confirm the nonce value, delete the nonce, "save the form data".
- Display confirmation page.
If you get another request with a non-existent nonce, then you know this is either a duplicate message or an even more evil CSRF attack.
You can find some support library that will do this for you.
source share