Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8880497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:10:37+00:00 2026-06-14T20:10:37+00:00

As a user requirement I have to disable the backspace button from navigating back

  • 0

As a user requirement I have to disable the backspace button from navigating back in the history. I made the following piece of code

   //Bind back nutton to prevent escaping the page with backspace
$j(document).unbind('keydown').bind('keydown', function (event) {
  var doPrevent = false;

  if (event.keyCode === 8) 
  {
      if(event.target == document.body){
          if(event.preventDefault()){ event.preventDefault(); }
          event.stopEvent();
          event.returnValue = false;
      }
  }
});

This is working perfectly in all the browsers except IE7 and IE8. I cannot bind the input types as exceptions because the content editor in SharePoint allows modification of the text in the elements div, paragraph, etc. The solution is not working in IE8 because the event.target returns the element that is on mouseover when there are no controls that have the focus.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:10:38+00:00Added an answer on June 14, 2026 at 8:10 pm

    Solved by myself, case closed.

    EDIT: Working in 2012 with SharePoint 2010 and jquery 1.x, not sure about today.

    //Bind back button to prevent escaping the page with backspace
    $(document).unbind('keydown').bind('keydown', function (event) {
        if (event.keyCode === 8) 
        {
         var doPrevent = true;
         //Chrome, FF, Safari
         if(event.target == document.body){
          doPrevent = true;
         }
         //IE
         else
         {
          var nodeName = event.target.nodeName.toLowerCase();
          if((nodeName == "input" && event.target.type == "text") || nodeName == "textarea")
          {
           doPrevent = false;
          }
          var SPEditTabInstance = $(document).find("li[id='Ribbon.EditingTools']");
          if(SPEditTabInstance != "undefined" && SPEditTabInstance != null && $(SPEditTabInstance).children().length > 0){
           doPrevent = false;
          }
         }
    
         if(doPrevent)
         {
          //Chrome, FF, Safari
          if(event.preventDefault()){ event.preventDefault(); }
          //IE
          else
          {
           event.returnValue = false;
          }
         }
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a requirement that when the user clicks on [X] button of the
I have the following requirement: Based on some user input, I need to generate
I have a requirement to enable/disable file sharing from with in the App. My
I have requirement that if user click on a button then the li should
I have a requirement to implement user privilege elevation in an MVC3 web app,
I have a requirement where I ask user for confirmation and also display messages.
I have a requirement that a user is allowed only to enter string value
I have a requirement where I have to detect if the user is not
I have a requirement wherein I need to display on a User form, a
I have a requirement in my MVC application to present the user with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.