Search code examples
sharepointiframeoffice-web-components

Office Web App malfunctions when opened in a frame


Viewing a docx document is implemented via starting a word app in iframe as follows:

<script type="text/javascript">
function appendPreview() {
    $('<iframe src="http://xxxxx/_layouts/WordViewerFrame.aspx?id=yyyyy.docx&Source=zzzzz" style="position: fixed; height: 100%; width: 100%"></iframe>').appendTo('body');
}
</script>
<button onclick="appendPreview()">Preview</button>

When executed, web app is started as expected, but shows "Word Web App cannot open this document due to an unknown error." Sharepoint logs say that "Detected use of SPRequest for previously closed SPWeb object. Please close SPWeb objects when you are done with all objects obtained from them, but not before." Everything works fine if source link is opened in a new browser tab rather than within iframe. Notably, actually showing the document only fails in IE, other browsers swallow this error.

Any ideas what could go wrong?


Solution

  • The issue was that I was requesting IE10 mode via meta directive, whereas Sharepoint 2010 only knows about IE9.