html5 - how to fix ,Backspace is acting as page back in Chrome -


in dynamic web application backspace acting page in chrome , wanted block or @ least warn user leaving page, in case unintentional.

please me.

its possible duplicate of how can prevent backspace key navigating back?

// prevent backspace key navigating back. $(document).unbind('keydown').bind('keydown', function (event) {     var doprevent = false;     if (event.keycode === 8) {         var d = event.srcelement || event.target;         if ((d.tagname.touppercase() === 'input' &&               (                  d.type.touppercase() === 'text' ||                  d.type.touppercase() === 'password' ||                   d.type.touppercase() === 'file' ||                   d.type.touppercase() === 'search' ||                   d.type.touppercase() === 'email' ||                   d.type.touppercase() === 'number' ||                   d.type.touppercase() === 'date' )              ) ||               d.tagname.touppercase() === 'textarea') {             doprevent = d.readonly || d.disabled;         }         else {             doprevent = true;         }     }      if (doprevent) {         event.preventdefault();     } }); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -