简体   繁体   中英

is postMessage JSON encoded/decoded in Google Chrome as it is in Firefox?

我知道它是HTML5规范的一部分,但有时WebKit不符合该规范的最新草案。

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 :-(

Update: From Firefox 6.0 the message parameter is serialized using the structured clone algorithm . It seems to work in Chrome now as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM