How to know, Outlook add in is running in Browser or App, using jquery or javascript. Is there any key to know whether it is running from browser or Outlook App
2 Answers
@Sunny, you can determine this by using Office.onReady
Here's sample code for you:
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.
}
});
More info can be found here
Comments
You can use Office.context.mailbox.diagnostics.hostName, which returns Outlook, OutlookIOS, or OutlookWebApp
Use Office.context.platform, which works for office add-ins in general (not only Outlook), this returns Office.PlatformType
1 Comment
Brian Clink
I upvoted this answer, which is the right answer, despite the downvotes. The Outlook Add-ins Team misunderstood the question.