is postMessage JSON encoded/decoded in Google Chrome as it is in Firefox?
-
16-09-2019 - |
Question
I know its part of the HTML5 spec, but sometimes WebKit doesn't conform to the latest draft of the spec.
Solution
Alas WebKit's worker postMessage implementation doesn't currently serialise objects as it was written to an earlier version of the spec, and hasn't yet been updated to match the "final" version.
It's not actually JSON either -- it's the internal structured cloning algorithm in html5, which is more efficient (it doesn't need to convert to and from string) and actually somewhat richer than JSON, however no one currently implements that :-(
OTHER TIPS
Update: From Firefox 6.0 the message parameter is serialized using the structured clone algorithm. It seems to work in Chrome now as well.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow