User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 363,508 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,443 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 12263 | Replies: 19
Reply
Join Date: Apr 2007
Posts: 26
Reputation: BalagurunathanS is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
BalagurunathanS's Avatar
BalagurunathanS BalagurunathanS is offline Offline
Light Poster

How to disable back button and backspace using Javascript..?

  #1  
Sep 4th, 2007
Hi Friends..
In my web application(ASP.net), i need to disable the "Back" button in the browser.Moreover i also need to disable the Backspace key in my keyboard when my web page is run..How to do it with javascript..? Someone help with javascript as early as possible..
Regards,

Balaguru
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Location: New Jersey
Posts: 1,421
Reputation: stymiee is on a distinguished road 
Rep Power: 5
Solved Threads: 33
Moderator
Staff Writer
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: How to disable back button and backspace using Javascript..?

  #2  
Sep 4th, 2007
You can't disable the back button. The best you can do is to open a new window with JavaScript and remove that toolbar. But if the page loads in a window with the toolbar you can't disable it.

You also can't disable the keyboard but you can use JavaScript to ignore certain keys from being acted upon. You need to intercept the event and then ignore it.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote  
Join Date: Sep 2007
Posts: 4
Reputation: sandeep.mk is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sandeep.mk sandeep.mk is offline Offline
Newbie Poster

Re: How to disable back button and backspace using Javascript..?

  #3  
Sep 11th, 2007
HI

how to disable IE back button , as my jsp page conatins 3 frames , so how can i disable/ stop the operation of back/forward button.

regards
sandeep.
Reply With Quote  
Join Date: Apr 2007
Posts: 26
Reputation: BalagurunathanS is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
BalagurunathanS's Avatar
BalagurunathanS BalagurunathanS is offline Offline
Light Poster

Re: How to disable back button and backspace using Javascript..?

  #4  
Sep 11th, 2007
Sorry Sandeep..

It caused a lot of problems for me..I gave it up..

Regards,
Balagurunathan S
Reply With Quote  
Join Date: May 2006
Location: New Jersey
Posts: 1,421
Reputation: stymiee is on a distinguished road 
Rep Power: 5
Solved Threads: 33
Moderator
Staff Writer
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: How to disable back button and backspace using Javascript..?

  #5  
Sep 11th, 2007
Both of you need to read my post. I gave you the answer in there.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote  
Join Date: Sep 2007
Location: pune
Posts: 3
Reputation: sreekiran is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sreekiran sreekiran is offline Offline
Newbie Poster

Re: How to disable back button and backspace using Javascript..?

  #6  
Sep 12th, 2007
using
<script>
function disable()
{
document.getElementById("").Disable=true
}
</script>
<body>
using this function in ur onclick="disable()" method
</body>
Reply With Quote  
Join Date: May 2006
Location: New Jersey
Posts: 1,421
Reputation: stymiee is on a distinguished road 
Rep Power: 5
Solved Threads: 33
Moderator
Staff Writer
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: How to disable back button and backspace using Javascript..?

  #7  
Sep 12th, 2007
That doesn't work for the back button since it isn't part of the web page.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote  
Join Date: Jan 2007
Posts: 2,361
Reputation: MidiMagic is on a distinguished road 
Rep Power: 6
Solved Threads: 90
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Nearly a Posting Maven

Re: How to disable back button and backspace using Javascript..?

  #8  
Sep 13th, 2007
The "Back" button belongs to the user, not to you. You have no right to disable it, since it might be the only way the user has to return to the page he came from to get to your page.

I have seen people use such tricks as removing the toolbar or forwarding to a second page. These make me mad at the programmer, because he denies me the opportunity to complete my tree search of a Google request or another website.
Daylight-saving time uses more gasoline
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,696
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 314
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Rebellion Revamped

Re: How to disable back button and backspace using Javascript..?

  #9  
Sep 14th, 2007
The annoyance with the 'Back' button, I fear is not universal. There are cases (read Intranet applications) where the client has requirements for the web application to look like a desktop application, making the removal of toolbars necessary.

BalagurunathanS, the only way to disable the back button is to remove the entire toolbar in the way mentioned by Midimagic in his previous post.
"I don't accept change. I don't deserve to live."

"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
Reply With Quote  
Join Date: Jul 2006
Location: Deptford, London
Posts: 916
Reputation: MattEvans will become famous soon enough MattEvans will become famous soon enough 
Rep Power: 4
Solved Threads: 45
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Posting Shark

Re: How to disable back button and backspace using Javascript..?

  #10  
Sep 14th, 2007
For Intranet applications; it's much easier to control the browser being used to access the page... Open VB6, drop WebBrowser control on form, don't add any buttons that call the control's 'back' event; save; compile; backbutton-neutered IE6. Distribute to everyone onsite.

In any context, including Intranet applications, why should 'back' ever need to be disabled? Just accept it's there, and that it goes back ( to potentially anywhere ); and incorporate that into your plans. Don't overlook it up to the point that it becomes a problem.
Last edited by MattEvans : Sep 14th, 2007 at 3:41 pm.
If it only works in Internet Explorer; it doesn't work.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 3:59 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC