2

I'm struggeling to check if my hosted web application is opened by a browser or in the Outlook 2013/2016 client.

I have one web application, which must provide different features for users in a browser and in the Outlook 2013/2016 sandboxed iframe.

My approach

with AngularJS in the mainController:

$rootScope.isIFrame = false;
if (window.location !== window.parent.location) {
  // The page is in an iframe
  $rootScope.isIFrame = true;
};
$log.debug('isIFrame: ' + $rootScope.isIFrame);
3
  • 1
    i hate to suggest this, but maybe checking navigator.userAgent would suit your needs. Commented Jan 21, 2016 at 22:29
  • do you have an idea which useragent is used by outlooks sandboxed iframe? Commented Jan 21, 2016 at 22:38
  • 1
    no, just dump it out to the screen with js: document.body.innerHTML=navigator.userAgent Commented Jan 21, 2016 at 22:42

1 Answer 1

1

Check out Office.context.mailbox.diagnostics.hostName:

Gets a string that represents the name of the host application. A string that can be one of the following values: Outlook, Mac Outlook or OutlookWebApp.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.