kavun
kavun

Reputation: 3381

IE8 shows mixed content warning when calling ITHit.WebDAV.Client.DocManager.EditDocument from an iframe

When calling ITHit.WebDAV.Client.DocManager.EditDocument() with ITHitWebDAVClient.js v1.6.0.1174 in IE8 from an iframe, the browser shows a mixed content warning like the following:

IE8 Security Warning

To proceed, the user must click No. How can I fix this? I am calling EditDocument() from a HTTPS site (ex: https://testfilebrowser.com/) and the file URL provided to EditDocument() is a HTTPS WebDAV URL implemented as a HTTPListener (ex: https://webdavhttplistener.com/folder/file.xlsx). The site URL and the WebDAV URL are on two different domains.

I have also tried implementing the WebDAV server in IIS under the same website as the caller so that they are on the same domain. That did not work either. For example: the HTTPS site caller https://testfilebrowser.com/ and the file URL https://testfilebrowser.com/DAV/folder/file.xlsx

I am aware that the end user may choose to suppress mixed content warnings by adjusting browser security settings, but that is not the solution I'm looking for. Is there a way to ensure that the mixed content warning does not show at all when calling EditDocument() from an iframe?

Upvotes: 1

Views: 250

Answers (1)

kavun
kavun

Reputation: 3381

Calling EditDocument() from inside an iframe shows a mixed content warning in IE8. One way around this is to use an instance of ITHit that is outside of the iframe to call EditDocument() from.

For example:

<!-- include ITHitWebDAVClient.js on parent page outside of iframe -->
<script src="ITHitWebDAVClient.js"></script>

<iframe src="...">
    <button onclick="editDocument();">Edit</button>
    <script>
        function editDocument() {
            /*
             * grab ITHit instance from parent when this executes inside iframe so that
             * a mixed content warning is not shown in IE8 when calling EditDocument()
             */
            if (window.parent !== window && typeof window.parent.ITHit !== 'undefined') {

                // use parent's ITHit instance
                ITHit = window.parent.ITHit;

                // call EditDocument()
                ITHit.WebDAV.Client.DocManager.EditDocument(path)
            }
        }
    </script>
</iframe>

Upvotes: 1

Related Questions