How to handle back button event of the browser?
-
Hello friends, I want to handle "Back" buttons event of the browser in my code. I want to restrict the user from pressing back button..How can I do that? Thanks ,
Amit
You cannot. Don't worry, people ask this all the time. There's no way to handle it, it's not an event, it happens on the client. You can try to hack it, but not successfully. Usually when people ask this, it's because they have not written the code to handle logout properly, is that your issue ?
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
You cannot. Don't worry, people ask this all the time. There's no way to handle it, it's not an event, it happens on the client. You can try to hack it, but not successfully. Usually when people ask this, it's because they have not written the code to handle logout properly, is that your issue ?
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Thanks, Here logout is not the issue. I want to give message to user, if he clicks the back button only.. I Saw some bank sites..They closing the sessions if user clicks the back button..! How they do that? Need help..
Amit
Javascript. But it's not reliable as JS can be turned off by the user.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
Javascript. But it's not reliable as JS can be turned off by the user.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
This might help u... http://www.codeproject.com/KB/aspnet/NoCaching.aspx[^]
When you fail to plan, you are planning to fail.
-
Hello friends, I want to handle "Back" buttons event of the browser in my code. I want to restrict the user from pressing back button..How can I do that? Thanks ,
Amit
One thing you can do is redirect all links through
location.replace()
of JavaScript so that there would be no history and hence back button can be voided to some extent. You can also try using thehistory.forward()
trick.Vasudevan Deepak Kumar Personal Homepage
Tech Gossips
All the world's a stage, And all the men and women merely players. They have their exits and their entrances; And one man in his time plays many parts... --William Shakespeare -
This might help u... http://www.codeproject.com/KB/aspnet/NoCaching.aspx[^]
When you fail to plan, you are planning to fail.