我正在使用 postMessage API 将保存命令发布到我的 Zoho writer iframe。按照文档我有这个
XDC.setTarget({
"origin": "https://api.office-integrator.com",
"window": document.getElementById("zoho-writer").contentWindow
});
XDC.postMessage({
"message": "SaveDocument",
"data": {
"hideSaveButton": true, // Default value will be true
"forceSave": true, // Default value will be true
"saveUrlParams": JSON.stringify({ apikey: "<my key>" }),
"format": "docx"
},
// Use "SaveDocumentResponse" event for oncomplete
"onexception": function(data) {
var x = 1;
},
"oncomplete": function (data) {
var x = 1;
}
} );
我只是猜测 saveUrlParams 因为他们没有解释其他的,然后说它是一些 JSON。每当我运行此命令时,我都会收到代码 1108 的异常响应和域未注册的消息。我已进入我的 Zoho 帐户 - 白标 - 安全控制 - PostMessage 域并添加我的域。
有什么想法吗?