none
Cannot open Office Documents in SharePoint add-In iFrame RRS feed

  • Question

  • We have a SharePoint Hosted app that lets user upload office documents , PDF's and videos from the user interface. When we click on each uploaded file , we want it to open in an iFrame. We have successfully implemented this feature on Office365 and it works perfectly . The documents open on Office web app On O365.

    But the same code does not work on sharepoint 2013 on-premise. We have installed and configured an Office web apps server successfully and want to use that to render documents inside our add-in into an iFrame. But the documents when clicked always download and do not open in iFrame in office web apps. Screenshot is pasted below the code .Any help would be appreciated

    Heres the angularjs code : 

    ------------

    function loadSelectedDocument(docUrl) {
                var iFrameEle = $('.documentFrame');
                var ext = docUrl.substring(docUrl.lastIndexOf('.') + 1).toLowerCase();

                var iframeTemplate = '<iframe id="documentFrame" class="documentViewer" src="' + docUrl + '" style="width:100%;min-height:420px;text-align:center;height:100%">Select Topic</iframe>';
                var videoTemplate = ' <video   id="documentVideo"  class="documentViewer" controls autoplay src="' + docUrl + '" type="video/wmv" style="width:100%;min-height:420px;text-align:center;height:100%">  </video>';

                vm.htmlForSelectedFileType = ext == 'mp4' || ext == 'wmv' ? videoTemplate : iframeTemplate;

                $.each(iFrameEle, function (index, object) {
                    $(object).empty().html(vm.htmlForSelectedFileType);
                });
            }

    -----------------------------------

    screen shot is pasted below. I would like to know What needs to be modified in order for it to work ?

    Tuesday, May 2, 2017 1:03 PM

All replies

  • Hi,

    For this issue, please make sure that the documents in the library can be opened in Office Web Apps first.

    And then make sure that the file type is supported to be opened in Office Web Apps, and make sure that the file type is one of the Trusted file (MIME) types.

    Please also debug your code to see if the function has been executed.

    Best Regards,

    Victoria

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, May 4, 2017 7:37 AM
    Moderator
  • Hi,

    I am checking to see how things are going there on this issue. Please let us know if you would like further assistance.

    Best Regards,

    Victoria


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, June 1, 2017 12:08 PM
    Moderator