Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

Synthesizing a MessageEvent object with the "data" property set to an object

$
0
0

The MSDN document says that the data member of a MessageEvent object is a string (http://msdn.microsoft.com/en-us/library/ie/ff974885(v=vs.85).aspx). Sure enough, when initMessageEvent is called and an object is passed in for this member, it is serialized to "[Object object]". However, when postMessage is called with an object payload, any associated event listeners are invoked with a MessageEvent object who "data" property is set to the same object passed to postMessage.

We need to be able to synthesize the same MessageEvent object as is passed to postMessage. I played around with this for a while but wasn't able to find any way to do so. The initMessageEvent converts the object to a string as described above, and it doesn't appear to be possible to modify the "data" member afterwards.

Is there any way to synthesize a MessageEvent object that looks like the one create by postMessage with the data property set ot an object?


Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>