Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
160
rated 0 times [  161] [ 1]  / answers: 1 / hits: 43072  / 13 Years ago, tue, july 12, 2011, 12:00:00

I got the following code to refresh my webpage. It works great if I don't submit anything with POST but if i do, i get a message from the browser when my webpage refreshes (see image below)



location.reload(true);


I'm not looking for the browser settings tweak. I'm looking for alternative code to refresh without asking.
enter


More From » javascript

 Answers
69

This is caused due to the page being requested by POST instead of GET. Refreshing will resubmit the POST data. You can force a get using window.location = window.location.href;.



If you want to allow people to reload the page through their browser controls then you will need to implement the PRG pattern which redirects to a GET after a POST.


[#91230] Monday, July 11, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
pranavrorys

Total Points: 466
Total Questions: 87
Total Answers: 115

Location: Barbados
Member since Sun, Nov 27, 2022
2 Years ago
pranavrorys questions
Fri, May 27, 22, 00:00, 2 Years ago
Thu, Oct 28, 21, 00:00, 3 Years ago
Sat, May 30, 20, 00:00, 4 Years ago
Fri, Dec 20, 19, 00:00, 5 Years ago
;