Max
Max

Reputation: 1334

Restrict confirm message on page reload with f5

In my JSP page I am using post method while submitting the page. So once I go from Page 1 to page 2. In Page 2, If I press F5 I am getting alert as

"To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."

I knew this question is a bit sarcastic but please give me an Idea. I can't change my method from POST to GET because I need to send large amount of data.

Thanks in advance...

Edited: In my Page1.JSP I call onClick function in that function I call action as "/page2servlet.do". Now, In Java side I use Spring Framework. With MVC Object I return to page2.jsp.

So where do the response.sendRedirect Fit.

Upvotes: 1

Views: 1518

Answers (4)

MeetM
MeetM

Reputation: 11

 <?php

 session_start();

 if(!isset($_SESSION['disablethispage'])){
 $_SESSION['disablethispage'] = true;
 // serving the page first time

 }else{
 // visited before or page was refreshed

 }

 ?>

Upvotes: 1

mplungjan
mplungjan

Reputation: 178010

Here is a version that replaces the next page:

http://plungjan.name/testredirect.html -> redirect.php -> thanks.html

and here is redirect.php

<meta http-equiv="refresh" content="3; url=http://plungjan.name/test/thanks.html">
<script>
location.replace("http://plungjan.name/test/thanks.html");
</script>

redirecting..

.

Upvotes: 0

bezmax
bezmax

Reputation: 26132

After doing POST save all the info you will need to session and send an instant redirect to other page with GET. Then on that other page get all the info you need from session.

However, after the session expires user wont be able to press Refresh. Also, it will break multi-windowing. User won't be able to do 2 distinct submits in separate windows as they will share same session object.

Upvotes: 1

Alex
Alex

Reputation: 249

Do a redirect to Page 2 after POST. You will not receive the prompt anymore.

Upvotes: 3

Related Questions