How do I reload a page without a POSTDATA warning in Javascript?

Ricibald picture Ricibald · Feb 20, 2009 · Viewed 139.4k times · Source

I want to reload a page using:

window.location.reload(true); 

But I receive the POSTDATA warning because the refresh function want to resend previous POST form data. How can I refresh my page without this warning?

UPDATED: I have no control of the project! I can't workaround the POST itself!

Answer

Rex M picture Rex M · Feb 20, 2009

You can't refresh without the warning; refresh instructs the browser to repeat the last action. It is up to the browser to choose whether to warn the user if repeating the last action involves resubmitting data.

You could re-navigate to the same page with a fresh session by doing:

window.location = window.location.href;