Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reloading page through javascript: avoid the "Postback" warning

I'm triggering a page reload through javascript, using the following:

window.location.reload(true);

However, in some cases (of previous postback), the browser is giving me the following warning "To Display the webpage again, the web browser needs to resend the information you've previously submitted...".

Is there any way of avoing this message and just doing the postback anyway, because this might be confusing for the users? If I need to reload the page by another means, so be it.

like image 564
Sam Avatar asked Dec 13 '22 19:12

Sam


2 Answers

if you want to refresh the page without including post data and not just postback try

window.location = window.location.href;
like image 172
Michael Avatar answered Mar 05 '23 23:03

Michael


I don't think there is any way to do a postback without the message when you are doing the reload.

Btw, whats the reload for? If it is for submitting the POST information again, i suggest you manually submit the data through ajax or a hidden form submission using javascript.

like image 40
mays Avatar answered Mar 05 '23 23:03

mays