tags:

views:

63

answers:

2

I would like to Disable Back button when user click on logoff for this i delete only cookies of that user not session in my application. And want to disable Back button

if(getCookie('username') == ""){
   Disable back button;// we use "window.history.redirect" for javascript i look jquery for this

}

Please help me..

+1  A: 

dupe

conclusion: it's not possible. even with our holy grale jQuery :)

Andreas Niedermair
it is, it's just not recommended.
meder
nope ... without tricking around with popups it won't be able. you can, in some way, hinder showing old content, but not clicking the back button (eg. a token for each page, a cookie for each page, ...)
Andreas Niedermair
A: 

This is not exactly your approach, but you may disable the navigation panel of any window using plain javascript. Just set window.menubar and window.toolbar visibility to false as follows,

window.menubar.visible = false ;
window.toolbar.visible = false ;

Update:

Changing the menubar and toolbar visibility of an existing window seems to violate security protocols. (https://developer.mozilla.org/en/DOM/window.menubar)

Therefore the only real way is to open a new window with menubar and toolbar set to "no" in the first place:

window.open(url,name,"menubar=no,toolbar=no[, additional options]",true) ;

If you set the replace argument (the last argument) to true the new window should also inherit the history of the window it was opened in.

Check https://developer.mozilla.org/en/DOM/window.open and http://msdn.microsoft.com/en-us/library/ms536651(VS.85).aspx for reference.

FK82
-: not working in eg. ff.+: good idea, but the safest way for disabling menu is opening a new window and set proper options!
Andreas Niedermair
I did not know that. Thanks.
FK82
Is there any other way to do the same thing? because i am stuck on this problem so plz help me....
Check my update please. I think this is the best you can do.
FK82