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);
navigator.userAgentwould suit your needs.document.body.innerHTML=navigator.userAgent