| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |
|

03-11-04, 06:13
|
|
Registered User
|
|
Join Date: Feb 2004
Location: India
Posts: 135
|
|
|
Disable Back Button
|
|
hi all,
how to disable browser's back button...
for example:
i am in first.asp and then i am going to second.asp by pressing submit button.here, u can see browser's back button will be enabled.....
but, what i need is ,
in second.asp page ....i should not see back button will enable....
so plz give code,how to disable browser's back button.....
|
|

03-11-04, 09:17
|
|
Registered User
|
|
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
|
|
can't do it.... full stop. end of story, thanks for playing
|
|

03-11-04, 09:56
|
|
Registered User
|
|
Join Date: Feb 2004
Location: India
Posts: 135
|
|
|
|

03-11-04, 22:31
|
|
Registered User
|
|
Join Date: Dec 2003
Posts: 454
|
|
Close your browser of your first page and open the new one for your second page.
|
|

03-12-04, 01:29
|
|
Guru
|
|
Join Date: Jun 2003
Location: USA
Posts: 1,032
|
|
A1ien51's disable the Back Button
http://www10.brinkster.com/A1ien51/S...BackButton.htm
What is going to happen, is when the page loads, it will send the surfer to the last page in their history.
Now if a person tries to go back to it, then it will send them directly back to the page they pushed the back button on!
Add this code to the header of your page:
<script>
history.forward();
</script>
JPS: Thus need to put the code on the page you don't want the user to be able to go back to.
And here is my version of it:
<script type="text/javascript"> <!--
// Disable browser's Back button on another pg being able to go back to this pg.
history.forward();
//-->
</script>
|
|

03-12-04, 01:54
|
|
Registered User
|
|
Join Date: Feb 2004
Location: India
Posts: 135
|
|
|
|

03-12-04, 15:56
|
|
Registered User
|
|
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
|
|
it'll only work if they press the back button once. Pressing it multiple times will return them eventually to a page without this code. So techincally you have disabled it at all...
|
|

03-12-04, 16:47
|
|
Guru
|
|
Join Date: Jun 2003
Location: USA
Posts: 1,032
|
|
<<
it'll only work if they press the back button once. Pressing it multiple times will return them eventually to a page without this code. So techincally you have disabled it at all...
>>
I just tested clicking on the browser's Back button multiple times on some of my pages that actually use this feature and the back button WAS effectively disabled. 
|
|

03-14-04, 15:33
|
|
Registered User
|
|
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
|
|
Well I have tried it here and can easily leap back pages... of course it could be due to a slow connection speed due to dial up....
I'm not trying to knock the solution, I think it is the best you will get. I just want the guy to be aware that in essence it's not completely disabled...
Personally I can't understand why you would want to do something like that in the first place.
|
Last edited by rokslide; 03-14-04 at 15:36.
|

03-15-04, 03:21
|
|
Guru
|
|
Join Date: Jun 2003
Location: USA
Posts: 1,032
|
|
<<
Personally I can't understand why you would want to do something like that in the first place.
>>
Well I've used it for a confirmation page where a user just registered something and I don't want the user to just use the browser's back button to go back and change the last page (or pages before that) and in effect submit another registration...
|
|

03-15-04, 15:12
|
|
Registered User
|
|
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
|
|
In that case I'd disable the button that submits the the registration, not the back button.
|
|

03-15-04, 16:58
|
|
Registered User
|
|
Join Date: Dec 2003
Posts: 454
|
|
If the user types and hits the url on the browser the registration form will be submitted again. You can use session variable to prevent the user from double submit of the form.
|
|

03-15-04, 17:08
|
|
Registered User
|
|
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
|
|
Yup, depending on how the form can be submitted there are various ways to prevent the multiple submitting.... disabling the back button IMO is a cop out for doing the job properly... not trying to be rude or anything...
|
|

03-15-04, 18:35
|
|
Guru
|
|
Join Date: Jun 2003
Location: USA
Posts: 1,032
|
|
<<
If the user types and hits the url on the browser the registration form will be submitted again. You can use session variable to prevent the user from double submit of the form.
>>
Yes, session variables can and are being checked everytime a page is opened to make sure someone can't get in (again) if you don't want him too.
But the browser's back button is sort of a "loophole" to still allow the user back to a page you don't want him on anymore. For example even after a session times out a user can still hit the browser's back button and get onto a session variable protected page.
The code above keeps this from happening and works very well for this admittedly limited use purpose.
In other words I don't use this code very often but there are some times when it does come in handy.
|
|

03-15-04, 18:39
|
|
Registered User
|
|
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
|
|
Yeah, I can see that it would be kinda handy, but I wouldn't use it as a "this will stop them submitting multiple requests" solution. 
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|