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

  • Home
  • SEARCH
  • 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 7919929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:01:55+00:00 2026-06-03T16:01:55+00:00

Rather vague title, I know, but I’m binding a custom key event to the

  • 0

Rather vague title, I know, but I’m binding a custom key event to the document object to catch AltR combination keypresses, like this:

document.body.onkeydown = function(event){
    event = event || window.event;
    var keycode = event.charCode || event.keyCode;
    if (keycode === 82) {
        if (event.altKey) {
            if (!canReload) {
                canReload = true;
                window.location.href += "#doGreaseRefresh";
            } else {
                canReload = false;
                window.location.href = window.location.href.replace("#doGreaseRefresh", "");
            }

            return false;
        }
    }
}

The code runs as expected but also produces a rather annoying “beep” sound as well. How can I prevent this? return false didn’t prove to be the answer, so I’m wondering if it’s even possible.

Oh, and if you’re wondering, this is in a Chrome userscript (Content script) to refresh Stack Overflow’s home page every 10 seconds if I’ve pressed AltR, and to stop refreshing once I’ve pressed AltR again. 🙂

  • 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-03T16:01:58+00:00Added an answer on June 3, 2026 at 4:01 pm

    Not being able to stop the beep is apparently a bug in Chrome: http://code.google.com/p/chromium/issues/detail?id=105500. return false works in Firefox without a beep.

    Cheers-

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Somewhat misleading title, I know. Never actually wanted to store TimeZoneInfo object themselves: rather,
Sorry for the rather vague title, but it seemed befitting of a similarly vague
A rather cryptic title, but it's difficult to phrase. Say I have an object
The question title is rather vague, but here's my situation. I have roughly 700+
Sorry if this question is too vague, but I'd rather not muddy it's point
Sorry for the rather vague title, I couldn't think up a better description for
Apologies if the title is vague, but it's not the easiest question to describe.
Rather than population said DOM object with an external page such as HTML CFM
As title. I'm not interested in converting between FillOrder=2 and FillOrder=1. Rather, I have
I can't think of a good title, but my question is not as naive

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.