问题
I am trying to load my office addin within an Iframe. However the addin gives an error. The browser console log shows the message "Warning: Office.js is loaded outside of Office client". Is there a limitation in displaying an Office js application within an IFrame?
I am using Chrome browser
The aspx has a js file which loads the Office environment. From the console log I can see that the office environment is loaded. However at the end I get the warning message "Warning: Office.js is loaded outside of Office client"
回答1:
Yes, looks like it is a limitation, Office JS makes use of window.external
to communicate with the Office client.
If you iframe it, window.external
will not return parent's external, so that could be the reason for the below error.
Warning: Office.js is loaded outside of Office client
You can try updating the external, but I recommend you not to iframe.
window.external = window.parent.external;
来源:https://stackoverflow.com/questions/55744841/loading-office-js-addin-inside-iframe-gives-error