Skip to content
Advertisement

parent.postMessage(data) failing

This may be more of an Apache issue, but I am experiencing the issue within php.

I have a php page that is called from within an iframe from a separate HTML page. I return the results from the php utilizing parent.postMessage(data); This had been working without issue. Changes were made in XFRAME options to allow an external site to access the page within the iframe.

“data” is a JSON HTML encoded array.

Now parent.postMessage(data) fails and the browser (Edge) gives the error “0: Argument not optional”.

I am not familiar enough with Apache options to point the admin toward what might resolve the issue. Does anyone have any suggestions?

Advertisement

Answer

postMessage expects two arguments, so the second argument (target argument) is not optional, to fix this you would have to write parent.postMessage(data, '*')

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement