Dialog with TinyMCE causes error 12003

六眼飞鱼酱① 提交于 2019-12-10 23:45:09

问题


With the newest update to Word (1611) dialogs with TinyMCE causes error 12003: Invalid URL Syntax.

According to Use the Dialog API the cause is

The dialog box was directed to a URL with the HTTP protocol. HTTPS is required.

Simple example is to put below code in a dialog (oddly enough it works in a panel).

Updated code

<!DOCTYPE html>
<html>
<head>
    <title>Office.js with TinyMCE</title>
    <meta charset="utf-8" />
    <script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js" type="text/javascript"></script>
    <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
    <script src="https://cdn.tinymce.com/4/tinymce.min.js"></script>
    <script type="text/javascript">
        (function () {
            "use strict";

            // The initialize function must be run each time a new page is loaded.
            Office.initialize = function (reason) {
                $(document).ready(function () {
                    tinymce.init({ selector: 'textarea' });
                });
            };
        })();
    </script>
</head>
<body>
    <textarea></textarea>
</body>
</html>

Edit1: This is only a problem on Windows. On Mac it works fine.

Edit2: The code for opening the dialog

var url = 'https://' + location.host + '/dialog.html';
console.log('url: ' + url); // url: https://localhost:44341/dialog.html
Office.context.ui.displayDialogAsync(url, { height: 30, width: 20 });

回答1:


We've identified the issue. Turns out we are blocking the javascript: URL protocol which seems to be invoked when using TinyMCE. We are working on a fix.




回答2:


12003 usually indicates you don't have https on your dialog url. This issue is more likely raised when displayDialogAsync is called, you are passing a HTTP url in the first argument.

For your html page with TinyMCE, I am able to copy-paste the entire html and open it in Office dialog. Therefore it is unlikely related to the tinyMCE.

(It will be much helpful you could share your code opening up the dialog.)

Best Regards



来源:https://stackoverflow.com/questions/41164617/dialog-with-tinymce-causes-error-12003

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!