# Iframe PostMessage --\> No result

**URL:** <https://forum.collaboraonline.com/t/iframe-postmessage-no-result/980>\
**Category:** User Support\
**Created:** [March 24, 2022, 8:37pm UTC](https://forum.collaboraonline.com/t/iframe-postmessage-no-result/980 "2022-03-24T20:37:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmlm](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/jmlm/32/1909_2.png) [@jmlm](https://forum.collaboraonline.com/u/jmlm)\
**Post date:** [March 24, 2022, 8:37pm UTC](https://forum.collaboraonline.com/t/iframe-postmessage-no-result/980/1 "2022-03-24T20:37:14Z")

</div>

Hi,

I’m trying to post message to a iframe containing Collabora document.  
The frame is OK And I receive some messages :  
_==== receiveMessage: {“MessageId”:“Views\_List”,“SendTime”:1648153588752,“Values”:[{“ViewId”:“0”,“UserName”:“eagerCoati3”,“UserId”:“eagerCoati3”,“Color”:411298,“ReadOnly”:“0”,“IsCurrentView”:true}]} iframe:71:10_  
_==== receiveMessage: {“MessageId”:“Doc\_ModifiedStatus”,“SendTime”:1648153588765,“Values”:{“Modified”:false}}_  
I Try to post the Host\_postmessagesReady (But I don’t know if it is OK - I can see the message in the console ==\> the post is done !) :  
if (msg.Values.Status == ‘Document\_Loaded’) {  
console.log(’==== inform the wopi client that we are ready to receive messages’);  
var iframe = document.getElementById(‘inlineFrame’);  
iframe = iframe.contentWindow || (iframe.contentDocument.document || iframe.contentDocument);  
iframe.postMessage(JSON.stringify({ ‘MessageId’: ‘Host\_PostmessageReady’ }), '_’);  
}_

But if I try to post something else Close or Save for example : Nothing. ==\> No response and nothing in the logs (coolwsd and wopi).

The src for save function :  
function save() {  
console.log(‘save the document…’);  
post({  
“MessageId” : “Action\_Save”,  
“Values” : {  
“DontTerminateEdit” : true,  
“DontSaveIfUnmodified”: false,  
“Notify” : true  
}  
});  
}  
function post(msg) {  
console.log("==== sending new message : " + JSON.stringify(msg));  
var iframe = document.getElementById(‘inlineFrame’);  
iframe = iframe.contentWindow || (iframe.contentDocument.document || iframe.contentDocument);   
iframe.postMessage(JSON.stringify({ ‘MessageId’: ‘Host\_PostmessageReady’ }), ‘_’);  
iframe.postMessage(JSON.stringify(msg), '_’);  
}

Console :  
==== sending new message : {“MessageId”:“Action\_Save”,“Values”:{“DontTerminateEdit”:true,“DontSaveIfUnmodified”:false,“Notify”:true}}

I don’t know how I can start coolwsd in debug mode to have some log to see what is going wrong !

I’ve also tried whith the framed.doc.html ([online/framed.doc.html at master · LibreOffice/online · GitHub](https://github.com/LibreOffice/online/blob/master/loleaflet/html/framed.doc.html)) with a modified uribase → Same results.

Wopi and coolwsd are on the same server - Everybody (client and server) is on the same LAN without Firewall.

Regards

---

<div class="post-metadata">

**Author:** ![jmlm](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.collaboraonline.com/jmlm/32/1909_2.png) [@jmlm](https://forum.collaboraonline.com/u/jmlm)\
**Post date:** [March 25, 2022, 9:56pm UTC](https://forum.collaboraonline.com/t/iframe-postmessage-no-result/980/2 "2022-03-25T21:56:30Z")

</div>

I Reply to myself !

It finally works (don’t know why it didn’t work …).  
I didn’t find a simple example, so I 've made one here : [GitHub - jmlm74/CollaboraOnline-iframe](https://github.com/jmlm74/CollaboraOnline-iframe)
