In my JSP page, i am using
response.sendRedirect(..) to redirect to an HTML page.
Is it possible to use javascript to detect whether a redirect occurred versus a page reload?
Thanks.
In my JSP page, i am using
response.sendRedirect(..) to redirect to an HTML page.
Is it possible to use javascript to detect whether a redirect occurred versus a page reload?
Thanks.
The easiest way I can think of to achieve this would be to put a timestamp in the query string of the redirect and read this in javascript. Set a cookie with this timestamp and detect whether it already exists to tell whether the page is being reloaded (has been loaded with the query-string before).
For how to read the query-string in javascript, see this article.
Of course, this won't work if the user has cookies disabled.