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

前端 未结 4 634
一个人的身影
一个人的身影 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:02

    Inspired by Sturb's answer, the following works with ExcelApi 1.10 & 1.12

    if (window.top.window == window) {
      // Add-in is running in Excel desktop
    } else {
      // Add-in is running in Excel online
    }
    

提交回复
热议问题