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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.