Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

controlling the browser's back & forward buttons

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi , I have a problem

In my project once the admin logged in he can manipulate the normal users data, then admin will logout , agin if the normal user logged if we press the browser's back or forward button the normal user can see the admin's details which shoul not. Please give ths solution to controll the browsre's back & forward button
Note: I need to controll more than one page it should be better if is generic , I am using JSP, with Struts 2.0


Thanks
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't control the browsers navigation controls but there are ways to make sure your app handles these events gracefully.

Look in the JSP FAQ for tips on setting the no-cache headers and the Post-Redirect-Get pattern.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes you can control the browser back and forword buttons from your code. But you can hide bar completely while opening the browser window using javascript function window.open(.......).
 
Sheriff
Posts: 67618
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by mnadeem chishti:
yes you can control the browser back and forword buttons from your code


No. You cannot.
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ben you're 100% right, you can't I've racked my head before searching for it but couldn't, but I've solved this problem as following..
I had two pages (signIn.jsp) and (account.jsp).
so after the user sign in perfectly he's forwarded to account.jsp
what causes the problem is that the user doesn't click on (sign out) link to invalidate his session, and instead he just clicks back button and the session is still alive..
so I've added

just at the very end of my (signIn.jsp) and the problem is solved...
 
Bear Bibeault
Sheriff
Posts: 67618
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Qussay Najjar:
...just at the very end of my (signIn.jsp) and the problem is solved...


This will, of course, only be effective if the user backs up all the way to the sign-in page. If they've clicked hundreds of links into the app, this is unlikely. And while this may invalidate the session, it does nothing to prevent cached pages.

Using the patterns that Ben mentioned is the best way to deal with these issues.
[ February 07, 2008: Message edited by: Bear Bibeault ]
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic