04-05-2009, 11:38 AM
Can any body provide me codes for restricting back button of window in homepage
I am Novice in developing webpages.I managed a session of 30 mins,Once I logged into the system through login page it redirects to homepage.jsp.and when I use this Back button in window it goes to previous page (login page).without session expired.
What i want is to restrict this back button in window of homepage to redirect back to login page.
Similar thing happens ..Once i logged out And if i press Back button in Window i get intto Homepage.jsp...(This should not happen)
04-05-2009, 10:47 PM
I don't know .jsp ...
But what if at the very beginning of every page, you check for
a valid session and decide what to do ... either display the page or not.
If they are logged-in, only 1 page on your website will be visible.
You also have your pages set-up for no-caching (using meta tag).
04-06-2009, 07:06 AM
Similar thing happens .."Once i logged out And if i press Back button in Window i get intto Homepage.jsp.."..Part i solved..
But what to do if i click back button in browser in Homepage.jsp...i am still redirecting to home page..
Login Page>> Home page >>(Back button)>>Login Page
Login Page>> Home page >>(Back button)>>Login Page >>(Back button) >>Home page
i want something ..like
Login Page>> Home page >>(Back button)>> Home page
04-06-2009, 01:44 PM
oh I see now ...
You can't affect a person's browser history (back or forward buttons).
So basically, you can control any links you have on your page, but nothing
you can do with the user's browser.
The same thing goes for their browser history ...
They may come back to their computer 2 days from now, and use their browser
history to get into the middle of your site ... and their back and forward buttons
will work the same way as before.
Maybe with some tricky redirects, you can force other pages to load if the
SESSIONS are a certain status. I'm a PHP guy, so I don't know the answer to
the .jsp method.
04-07-2009, 01:19 AM
in jsp jou can something like:
Pseudocode for login page
if sessionvariable(userAlreadyLoggedIn) = true
if not loged in, which is anyway if sessin expired, or not logged in at all, this would then show login page.