how to create keyboard shortcut in windows that call function in web application

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>HOTKEY</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="http://www.openjs.com/scripts/events/keyboard_shortcuts/shortcut.js"></script></head>
<body>
    <script>
        function callkey(){
            shortcut.add("1",function() {
            window.open('http://www.google.com', '_blank', 'toolbar=0,location=0,menubar=0');
            });
        }
        $(document).ready(callkey);
    </script></body>
</html>
OR:
<script>
    function callkey(){
        $(document).bind('keydown', 'a',function ()
        {
            window.open("http://www.google.com", "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,top=200,left=300,width=800,height=400");
            return false;
        });                   
    }
    $(document).ready(callkey);                           
</script>

Note : download hotkey js over here : https://code.google.com/archive/p/js-hotkeys/downloads

Post a Comment

0 Comments