The pitfalls of postMessage

Cross Site Scripting (XSS)

The postMessage API is an alternative to JSONP, XHR with CORS headers and other methods enabling sending data between origins. It was introduced with HTML5 and like many other cross-document features it can be a source of client-side vulnerabilities.

https://labs.detectify.com/2016/12/08/the-pitfalls-of-postmessage/