【问题标题】:Detect if web application is opened in outlook-add-in检测是否在 Outlook 加载项中打开了 Web 应用程序
【发布时间】:2016-01-21 22:28:09
【问题描述】:

我正在努力检查我的托管 Web 应用程序是由浏览器打开还是在 Outlook 2013/2016 客户端中打开。

我有一个网络应用程序,它必须在浏览器和 Outlook 2013/2016 沙盒 iframe 中为用户提供不同的功能。

我的方法

在 mainController 中使用 AngularJS:

$rootScope.isIFrame = false;
if (window.location !== window.parent.location) {
  // The page is in an iframe
  $rootScope.isIFrame = true;
};
$log.debug('isIFrame: ' + $rootScope.isIFrame);

【问题讨论】:

  • 我不想建议这个,但也许检查 navigator.userAgent 会满足你的需要。
  • 您知道 Outlook 沙盒 iframe 使用哪个用户代理吗?
  • 不,直接用js转储到屏幕上:document.body.innerHTML=navigator.userAgent

标签: javascript angularjs outlook office365 office-addins


【解决方案1】:

查看Office.context.mailbox.diagnostics.hostName:

获取表示主机应用程序名称的字符串。 可以是以下值之一的字符串:OutlookMac OutlookOutlookWebApp

【讨论】:

    猜你喜欢
    • 2019-10-20
    • 2019-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多