0

I want to activate a "ctrl+f1" shortcut key on a link? I am using scriptish!

i.e when I press "ctrl+f1" on a link it start to download, I want this action to take place automatically when the page is loaded?

1
  • You want to start a download when someone clicks a link and holds ctrl+f1 simultaneously? Sounds like a bad UX if you ask me. Jan 8, 2013 at 8:41

3 Answers 3

0

I'm assuming you don't need this to be a link on the page but simply a function that starts a download from a URL, and by that I mean that on a particular page this key combination would begin the download.

That said, there is something of a library that is available that enables you to create functions like so...

shortcut.add("Ctrl+F1", function() {
    // code to begin download, probably a location.href = "blah blah blah";
});

The library and all code needed is here. It's too long-winded to go into here, but this will get you what you need.

1
  • It does for me on Mountain Lion.
    – Ian Atkin
    Jan 8, 2013 at 8:53
0
$(function(e){
   //e is event control from you can track which event fired from keyboard
   if(e.ctrlKey && e.keyCode == 112)
   {
      //do your desired action here.
   }
});
-2

place your code under $(function(){ //Your code here });

your code will get executed as soon as your page is loaded.

1
  • It is a built in shortcut, I want to send a keypress or keydown event with "ctrl+f1" how can I do that?
    – user1957396
    Jan 8, 2013 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.