I am working on a word web add-in that is mostly finished and working fine in office 2016/2013 and word online on chrome, edge and firefox. However I am experiencing an issue with running it in word online on IE 11.
Users log into the app with an azure active directory account, which is done via a popup using the Office.context.ui.displayDialogAsync
method.
As I said this works fine everywhere except word online on IE.
The issue as far as I can tell is that on IE, in the popup it isn't seen as a valid office environment, and so office.js isn't initialised properly. Office.initialize never seems to be called and if initialise my app manually instead then an error ocurs when the popup tries to communicate back to the main window via Office.context.ui.messageParent
with the message: Unable to get property messageParent of undefined or null reference
.
Also supporting this is that when I check the host type with OfficeHelpers.Utilities.host
, in the popup on chrome or edge it shows "WORD" and on IE it shows "WEB", this seems to mean that Office.initialize is never called and Office.context.ui is left null?
Can anyone advise if I am missing something or is this some kind of bug in office.js?
I have tried using office js from https://appsforoffice.microsoft.com/lib/1/hosted/office.js
and also from the latest npm package and it is the same for both.
Edit: Having done some investigation into how displayDialogAsync
works I can see that when it creates the new window it captures the current context such as Word|Web|16.00|EN-US|<some guid>
. This seems to work everywhere but in IE, it does however work when simply opening a dialog of a regular page in IE, but when we sign into AD it must go to the AD sign in page then redirect back, which is where this value seems to be lost (in IE).
It seems the particular issue I was seeing (with the state not being preserved in IE after navigation) was due to the fact my web app was running locally and IE treats localhost as a different security zone to regular sites (such as the AD sign in page), which was causing the state to be lost when it transitioned between them.
I got it working by unchecking these boxes under intranet (so that localhost falls under regular Internet rules instead)