How can we use Keyboard shortcut for MVC application?. My requirement is when I press Ctrl+U , I want to load my home page and when I press Ctrl+T, nedd to open another page. How it is possible in client side. Please help.
Regards Sreyas MN
How can we use Keyboard shortcut for MVC application?. My requirement is when I press Ctrl+U , I want to load my home page and when I press Ctrl+T, nedd to open another page. How it is possible in client side. Please help.
Regards Sreyas MN
Capture the Events via Javascript.
KeyCode for Ctrl+U and Ctrl+ T using below code
$(document).bind('Keydown',function(event){
if(event.KeyCode== Keycode) // check for Keycode for Ctrl+U and Ctrl+ T
{
window.location.href(url);
}
});
use target="_blank" to open in new tab.
Just capture keyboard events on client script, when your desired key combinations fire redirect your code execution to the desired controllers with location.href
You can use jquery hotkeys
jQuery Hotkeys supporting almost any key combination.
$(document).bind('keydown', 'Ctrl+T', function(){
// Do what ever youwant
});