views:

21

answers:

0

I'm working on a way to make keyboard shortcuts. Initially I had done this:

function clicking(e) {  

    var code;

    if (!e) var e = window.event;
    if (e.keyCode) code = e.keyCode;
    else if (e.which) code = e.which;
    var character = String.fromCharCode(code);

        if(character == 'X' && e.ctrlKey) {
            window.location = 'http://www.example.org/';            
        } 

}

Where the user would press ctrl and X to redirect, or perhaps ctrl+alt+X. This works fine on windows of course, but on a Mac I'm having some problems. This was the simplest solution and I didn't want to overcomplicate it. On top of that my brain isn't functioning perfectly today, and I was wondering if there was any way around this on a Mac.

I want to keep the user experience the same throughout platforms.