Stop browsers asking to resend form data on refresh?
51531 просмотра
4 ответа
I have a form submission via POST. I submit the form, and all is well, however if I try to reload the new page that the form goes to after submission, I get the "Do you want to resend data" message (FireFox). It might happen in other browsers too, but I'm not sure.
Does anyone know of a way to stop this message popping up so I can go ahead and refresh the page. It's not good for production environments - users may submit the same form twice!
Автор: Bojangles Источник Размещён: 12.11.2019 09:28Ответы (4)
48 плюса
You need to use the the POST-Redirect-GET pattern.
Make your form respond with a redirect to a GET request.
This way, when the user refreshes the page, it will only re-send the GET.
9 плюса
An easy way after response.sendRedirect
is reload the page in this way:
window.location.href = window.location.pathname;
It works for me.
Автор: Merboy Размещён: 06.12.2012 08:101 плюс
If url does not have any parameter, use this -
window.location = window.location.href+"?rnd="+Math.random();
Or else use this -
window.location = window.location.href+"&rnd="+Math.random();
It will work.
Автор: Ashwin Размещён: 21.10.2014 06:100 плюса
It will be a security violation if browsers do that. For ex in credit card processing, the site may charge the user twice.
The only way round is go to address bar and hit enter. It will cause a new request.
Автор: Madhur Ahuja Размещён: 01.12.2010 05:43Вопросы из категории :
- html Определить часовой пояс пользователя
- html Как определить, какой из указанных шрифтов был использован на веб-странице?
- html Как мне дать моим веб-сайтам значок для iPhone?
- html Как отключить автозаполнение браузера в поле веб-формы / теге ввода?
- html Как автоматически изменить размер текстовой области с помощью Prototype?
- html Как вы можете настроить номера в упорядоченном списке?
- firefox Как подавить заполнение поля пароля Firefox?
- firefox Написание плагина Firefox для анализа пользовательского языка на стороне клиента
- firefox Как удалить пунктирный контур Firefox на КНОПКАХ, а также на ссылках?
- firefox Как определить, виден ли элемент DOM в текущем окне просмотра?
- firefox Why does the checkbox stay checked when reloading the page?
- firefox Пользовательский курсор изображения CSS
- post В чем разница между POST и PUT HTTP REQUEST?
- post Как я могу отправить HTTP-запрос POST на сервер из Excel, используя VBA?
- post Как вы отправляете сообщение в iframe?
- post Ruby: Как опубликовать файл через HTTP как multipart / form-data?
- post Получить параметры в URL с CodeIgniter
- post Предотвращение двойного HTTP POST