OfficeDev / office-js-docs

[ARCHIVED] Microsoft Office Add-ins API Reference Documentation
https://docs.microsoft.com/javascript/api/overview/office
398 stars 233 forks source link

does Office Online Server embed page supported ? #1529

Closed Lighfer closed 5 years ago

Lighfer commented 5 years ago

I've set up a Office Online Server and a WopiHost, now I'm able to preview and edit Word/Excel/PowerPoint. Now I'm trying to embed web-side office into my site using iframe, and using javascript to modify documentattions, I've tried following code, but it's doesn't log and alert anything, I wanna know it's that a possible behavior?

...

<iframe src='http://oos.demo.com/we/WordEditorFrame.aspx?embed=1&WOPISrc=http://localhost:8080/wopi/files/word.docx&ui=zh-CN'
        frameborder='0' style="width: 90%;height: 90%;">
</iframe>
<script src="https://appsforoffice.microsoft.com/lib/1/hosted/Office.js" type="text/javascript"></script>
<script type="text/javascript">
    Office.initialize = function () {
        $(document).ready(function () {
            console.log('23333');
            // After the DOM is loaded, add-in-specific code can run.
            alert('loaded');
        });
    }
</script>

...