Hi All,
I need to disable Back button of IE when an welcome.aspx page load into the browser.
I dont want the user to click back button after logging in.

Is there any code to disable the back button of IE?

Please send your suggestions.


Thanks and with regards,
Madhusudhan.H.K.

Recommended Answers

All 16 Replies

short answer is No. There is no direct way to disable the back button so that it is greyed-out and user cannot click on it. However, there are some tricks using javascript which might be able to give you the results you need,although they won't be as pretty. One I am currently working on involves using javascripts window.history function with a session variable and automatically logging off and redirecting to login page if user hits the back button. You can also do something as simple as:

<script language="JavaScript">
<!--
  javascript:window.history.forward(1);
//-->
</script>

Put that script at the top of every page. If user hits back button it will send them forward again.

short answer is No. There is no direct way to disable the back button so that it is greyed-out and user cannot click on it. However, there are some tricks using javascript which might be able to give you the results you need,although they won't be as pretty. One I am currently working on involves using javascripts window.history function with a session variable and automatically logging off and redirecting to login page if user hits the back button. You can also do something as simple as:

<script language="JavaScript">
<!--
  javascript:window.history.forward(1);
//-->
</script>

Put that script at the top of every page. If user hits back button it will send them forward again.

Yes ! Its working.
Thanks a lot,
Madhusudhan

Hi All,
I need to disable Back button of IE when an welcome.aspx page load into the browser.
I dont want the user to click back button after logging in.

Is there any code to disable the back button of IE?


where should I place the java script

Hi where should I place javascript

just like it says, at the top of every page

There is no way to disable the back button reliably. Every method, short of writing your own browser, can be easily disabled. This question has been asked millions of times, for years and years. The "back" button is integral to how browsers work, and is firmly a part of the user interface and the collective "user expectation". Trying to fight it is usually a sign of poor understanding of the web, a flawed application model , and/or bad design!

Users will press the "back" button. They will be irritated if it doesn't work. They will often simply close the browser completely if your application doesn't behave as they expect.

you cant disable only the back button
but u can sure hide the status bar (which includes several other buttons like refresh, forward etc )

Which can be gotten back again with one click.

Make a decent application instead; save yourself work and your users hassle.

There is no way to disable the back button reliably. Every method, short of writing your own browser, can be easily disabled. This question has been asked millions of times, for years and years. The "back" button is integral to how browsers work, and is firmly a part of the user interface and the collective "user expectation". Trying to fight it is usually a sign of poor understanding of the web, a flawed application model , and/or bad design!

Users will press the "back" button. They will be irritated if it doesn't work. They will often simply close the browser completely if your application doesn't behave as they expect.

*****

I am sometimes amazed at the arrogance of some software developers who think that, of the 6+ billion people on the earth, no one could possible have a need to disable the back button. We just are stupid and don't understand the problem. Well, he's wrong. Hint: Just help people with their questions and don't be a smart @.

*****

I am sometimes amazed at the arrogance of some software developers who think that, of the 6+ billion people on the earth, no one could possible have a need to disable the back button. We just are stupid and don't understand the problem. Well, he's wrong. Hint: Just help people with their questions and don't be a smart @.

I am no longer amazed by newbie posters who tell people that have consistently been on this (or any) forum for a long time helping people how to help people. Sometimes, the best way to help someone is to NOT answer the question they asked but answer the question they did not ask. No doctor would just give instructions on how to put your leg in a splint if someone said "Hey, I broke my femur, but I think I'll just tough it out. How should I splint it?" They would tell the person to go to the hospital and be seen by a doctor.

Boss,

it is ok for single window,
how about a jsp which contains 3 frames.

can u do for a jsp page which conatins 3 frames.

regards
sandeep.

hello people it works fine with IE 6 but suks at IE 7 & IE 8.

all above suggestions will not work in IE7 or Mozilla...

it works fine with IE6...

Ajax can help...

<script language="javascript" >

history.forward();

</script>

Write a javaScript

<script Type="text/javascript" language="javascript">
history.forward(1);
</script>

into the head of the page

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.