How to determine if an Office Add-in is running under Excel or Excel Online?

前端 未结 4 564
一个人的身影
一个人的身影 2021-01-03 04:50

I\'m writing an Office Add-in (formerly, Apps for Office). I\'m using office.js and in some point of code I want to check if the app is running in excel (deskto

4条回答
  •  时光说笑
    2021-01-03 05:15

    The question is how do you do it, not why would you want to. There are numerous reasons why you might want to differentiate. Put in this check as follows:

    if (window.top == window) {
    //the add-in is not running in Excel Online
    }
    else
    {
    //the add-in is running in Excel online
    }
    

提交回复
热议问题