I want to send a combination keystroke to the browser using Javascript. For example, CMD + A.  I tried this, but it doesn't seem to work. (Tested in Safari).
            Asked
            
        
        
            Active
            
        
            Viewed 2,271 times
        
    0
            
            
        - 
                    The example given was using `CTRL` + `KEY`, what type of keys do you mean by `CMD`? – Spencer Wieczorek Sep 23 '14 at 17:09
- 
                    `CMD` is probably the cmd key for a Mac – Marc-Andre Sep 23 '14 at 17:25
- 
                    What did you expect it to do? Trigger some event handlers? – Bergi Sep 23 '14 at 17:27
1 Answers
0
            I highly recommend mousetrap.js. It's intuitive, lightweight and very easy to use;
Edit: See this answer. Note that CMD+A (or any other combination) is not really both together - it's a keydown event for both before there is a keyup for either.
- 
                    I don't want to **detect** keyboard events, I want to **send** them to the browser. mousetrap.js does look great for detecting shortcuts, but that's not what I want to do. – Max Isom Sep 23 '14 at 19:52
- 
                    I updated my answer to include a link to http://stackoverflow.com/questions/961532/firing-a-keyboard-event-in-javascript which looks like what you're looking for. – Etai Sep 23 '14 at 19:57
- 
                    
 
     
    