如何知道,Outlook加载项正在浏览器或应用程序中运行,使用jquery或javascript。是否有任何密钥可以知道它是从浏览器还是Outlook应用程序运行
@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.
}
});
更多信息可以在这里找到
您可以使用Office.context.mailbox.diagnostics.hostName,它返回Outlook、OutlookIOS或OutlookWebApp
使用Office.context.platform,它通常适用于Office加载项(不仅仅是Outlook(,这将返回Office.PlatformType