I need to detect whether a user has hit the URL of my add-in from a browser, outside of Office and Office online. (I've seen questions here about detecting whether it is Excel, or Excel online, but not neither of them.)
I've looked at the utility functions OfficeHelpers.Utilities.host
and OfficeHelpers.Utilities.isAddin
but the code notes say these will only work after Office.initialize is called. If the URL has been navigated to from outside of an Office client then this won't be the case (?).
So I think I need to perform the same check as whatever is being done when you get the warning: Warning in Google Chrome ...to make sure that the Office.initialize will not be run, not that it hasn't run yet.
A simple use of this, would be to direct users to a page that displays explains they cannot access this without loading it as an add-in, and instructions on how to load the add-in etc.
The actual result I am trying to get is to handle both cases as:
From within an Office client: "GetData" will return some values and write them to a document. If accessed from a browser: "GetData" will return some values and redirect to a View to display these.