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 6734951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:57:02+00:00 2026-05-26T10:57:02+00:00

So far I’ve found many different articles on it but they all seem to

  • 0

So far I’ve found many different articles on it but they all seem to have conflicting advice and different levels of compatibility with different browsers. All a huge headache. Is there a fuss free way to parse a user’s keystrokes in a canvas element?

Even snippets such as this for disabling the shortcut keys don’t work for all browsers.

if(e.preventDefault) // non-IE browsers
        e.preventDefault();
    else  // IE Only
        e.returnValue = false;

Right now I’m using

document.addEventListener('keypress', KeyPressed, true); 

and

var keyCode = String.fromCharCode(e.charCode);

It works fine in firefox but nowhere else.

I’ll probably get it working eventually but is there a fuss free way to do it without pulling all my hair out? Seems strange that such a seemingly common feature would be so hard to implement. Thanks!

  • 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-05-26T10:57:02+00:00Added an answer on May 26, 2026 at 10:57 am

    “is there a fuss free way to do it without pulling all my hair out? ”
    Yea! You can if you use jQuery .
    Because jQuery can make life easier for you and works cross browser too.

    Just add this to your code,

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
    
    <script>
    $(document).ready(function(){
        $(document).keypress(function(event){
        if (event.which == 13)
            alert("You pressed the Enter Key");
        });
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So far i have the following code, but it doesn't seem to be working,
So far all the sites I have made have been in PHP, I'm thinking
So far I've found two different ways to access what I believe are equivalent
So far I have encountered adjacency list, nested sets and nested intervals as models
As far I have informed around the net after hours of research it is
So far, I almost always worked with no-interface EJBs and have a slight understanding
So far I've got: :notice :alert :error but is there definitive list, that can
so far, I have this: class Foo{ private $plugin_methods = array(); public function registerPlugin($caller,
So far I found how to do it in Chrome, the DOMSubtreeModified event: Is
So far I only found two ways: throw exception play nothing ad.2. Pretty recent

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.