Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a couple of decades experience using Emacs, so the Emacs-like keybindings for text editing on Mac OS X are very nice. Unfortunately, some websites (ahem) choose to override these with Javascript. For example, one of them makes controlB insert the text **strong text**, rather than going back one character.

Is there any way to make Safari ignore Javascript keybindings that try to remap the standard OS X keybindings?

share|improve this question
I don't know any general way to do that, but you could use GreaseKit to disable the WMD shortcuts. See Is there a way to disable the hotkeys? - Meta Stack Overflow. – user495470 Aug 13 '12 at 17:37
Thanks for the link! It's frustrating to see that they think it's fine just because people didn't complain enough. (I've been using SE sites for years and I didn't realize I needed to start complaining on day 1 for my voice to be heard.) I'm hesitant to add any web browser extensions, though, since the first part of any web browser issue diagnosis is "disable all extensions". – Ken Aug 13 '12 at 17:53
I'm with Ken. I personally can't count how many times I've had to use "undo" because my hands forgot I was on an SE site :S – ephsmith Aug 19 '12 at 0:42
I was going to suggest that you could disable javascript... It fixed your problem, but it created a new one — I could no longer post comments on StackExchange... =P – daviewales Dec 3 '12 at 8:06
Is this question about the site here? or about disabling javascript everywhere? I could move it to our meta as a bug report, but there's already several requests for this site wide.… – bmike Apr 30 '13 at 14:31

Here is Rob W's script from meta, updated to only block cntrl-* and fixed so that it works with NinjaKit which is a safari extension for running user scripts.



// ==UserScript==
// @name           Cya WMD shortcuts
// @namespace      Rob W
// @version        1.0
// @include*
// @include*
// @include*
// @include*
// @include*
// @include*
// @include*
// @include*
// @include          http://**
// @include*
// @include*
// @include*
// @run-at         document-end
// @grant          none
// ==/UserScript==
(function () {
    var p = document.getElementById('wmd-input');
    console.log("wmd-input:" + p);
    if (p) {
        p = p.parentNode;

        function ignore(e) {
            if (e.ctrlKey) {
        p.addEventListener('keydown', ignore, true);
        p.addEventListener('keypress', ignore, true);
        p.addEventListener('keyup', ignore, true);
share|improve this answer
More info... – Old Pro May 5 '13 at 21:27

It's been a while since I've used it, but the Privoxy proxy server has the feature to modify javascript to change behavior. If you're willing to run a proxy server, that is an option.

I did look (though not exhaustively), and didn't see a browser plugin that rewrote content (xml, html, CSS, or javascript) like privoxy does. In Privoxy's web page, look for the js-annoyances filter. That is where you'll find examples of rewriting javascript.

Perhaps there's a more modern implementation in the form of a browser plugin that provides a similar feature, but privoxy used to work fine for this use case.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.