none
Adding keyboard shortcuts to Office 2013 Apps to trigger JavaScript functions RRS feed

  • Question

  • Hello.

    I wonder if there's any way to add keyboard shortcuts to "Apps for Office 2013" I'm using JavaScript and would like to trigger different functions (JS) when different keyboard shortcuts are being pressed. Dose anyone know if it's possible and in that case how to do it.

    / Thanks in advanced - Isak

    Monday, June 16, 2014 7:41 PM

Answers

  • Hi Isak,

    Based on my understanding, the apps for Office is a HTML web page and it hosts in the Office application. I don’t think we can adding key board shortcuts to call the JavaScript function. But since it is an html page, if you active the page you can write your own business logic to handle the key press event. Here is a sample for your reference:

    <script>
    
    
            document.onkeypress = PressKeyHandle;
    
            function PressKeyHandle(e) {
    
              
                document.getElementById("message").innerText = "Hello";
    
            }
    
        </script>
    

    If you have any problems about JavaScript issues, you can get more effective response from Internet Explorer Web Development forum.

    Hope it is helpful.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Isak Ågren Wednesday, June 18, 2014 8:21 AM
    Tuesday, June 17, 2014 8:55 AM
    Moderator
  • Hi Isak,

    I am afraid that the current version of apps for Office doesn't support this feature. If you want to it supports this feature in the further version, I suggest you submit the feeback froml link below:
    Customer Feedback for the Office Developer Platform

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Isak Ågren Wednesday, June 18, 2014 8:20 AM
    Wednesday, June 18, 2014 2:51 AM
    Moderator

All replies

  • Hi Isak,

    Based on my understanding, the apps for Office is a HTML web page and it hosts in the Office application. I don’t think we can adding key board shortcuts to call the JavaScript function. But since it is an html page, if you active the page you can write your own business logic to handle the key press event. Here is a sample for your reference:

    <script>
    
    
            document.onkeypress = PressKeyHandle;
    
            function PressKeyHandle(e) {
    
              
                document.getElementById("message").innerText = "Hello";
    
            }
    
        </script>
    

    If you have any problems about JavaScript issues, you can get more effective response from Internet Explorer Web Development forum.

    Hope it is helpful.

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Isak Ågren Wednesday, June 18, 2014 8:21 AM
    Tuesday, June 17, 2014 8:55 AM
    Moderator
  • Hi again. do you know of a way to make those event work when your in the document typing so that you can use the keyboard shortcuts without having to kick on the app itself first. That would help greatly. Thank again.

    / Isak Ågren


    Tuesday, June 17, 2014 12:33 PM
  • Hi Isak,

    I am afraid that the current version of apps for Office doesn't support this feature. If you want to it supports this feature in the further version, I suggest you submit the feeback froml link below:
    Customer Feedback for the Office Developer Platform

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Isak Ågren Wednesday, June 18, 2014 8:20 AM
    Wednesday, June 18, 2014 2:51 AM
    Moderator