/    Sign up×
Community /Pin to ProfileBookmark

Using document.defaultAction

One of my scripts takes a keypress event and uses keycode 8(the delete key) and I was wondering how it would be possible that I can make it only do the action I specify and not go ‘Back’ in the brower also? I have been trying to make it work by setting it to false and returning it but it doesn’t work… Thanks.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@mrhooMay 20.2008 — The delete key is keyCode 46- the backspace is keyCode 8.

Some browsers don't let you override the backspace key, because some users need it to navigate.
Copy linkTweet thisAlerts:
@ChromoXauthorMay 20.2008 — There is a site...http://www.quirksmode.org/js/keys.html that is all about detecting keystrokes and when you go to the bottom and check disable default action when I push the backspace key it doesn't go back. Go try it out. I have looked at the source but I don't understand what extra stuff he is doing to make sure it doesn't go backwards.
×

Success!

Help @ChromoX spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...