怎么知道,Outlook添加是在浏览器或Outlook应用程序中运行,使用jquery还是javascript?

问题描述 投票:0回答:2

怎么知道,Outlook添加是在浏览器或应用程序中运行,使用jquery或javascript。是否有任何密钥可以知道它是从浏览器还是Outlook应用程序运行

outlook-web-addins
2个回答
1
投票

@Sunny,您可以使用Office.onReady来确定这一点

以下是您的示例代码:

Office.onReady(function(info) {
    if (info.host === Office.HostType.Outlook) {
        // This means you are running in Outlook.
    }
    else if (info.host == null) {
        // This means you are running in a browser, outside of Outlook
    }
    else {
        // This means you are running in some Office client that is NOT Outlook.
    }
});

更多信息可以在here找到


0
投票

您可以使用Office.context.mailbox.diagnostics.hostName,它返回Outlook,Outlook IOS或Outlook Web App

使用Office.context.platform,一般用于办公室加载项(不仅是Outlook),这将返回Office.PlatformType

© www.soinside.com 2019 - 2024. All rights reserved.