Is cross-origin postMessage broken in IE10?
Ensure correct use of postMessage
in IE10 by specifying the exact target origin and verifying the event origin. Here's your first-aid kit:
Comprehensive guide to make postMessage work in IE10
Embracing MessageChannel in IE10
postMessage
is usually reliable but IE10 tends to misbehave. MessageChannel
API offers the discipline IE10 needs:
Consult the MSDN MessageChannel documentation for extended reading material.
The policy-driven proxy conversation through an iframe
When MessageChannel
seems like learning a new language, there's a workaround using an agreeable proxy page on the same domain as the sender. A nifty iframe serves your message past the bouncer:
Becoming a percussionist with setInterval
Need to knock on their door periodically? Play it like a drum with postMessage
and setInterval
:
Ensure the receiving window isn't playing hard to get. Check the message origin!
Transporting objects with a JSON.stringify() suitcase
Remember to pack your objects neatly using JSON.stringify()
when sending them on a trip:
Fold them back to their shape after the journey:
Common patterns for a smooth sail
Making sure every browser is on the same page
postMessage
behaves well with modern browsers but always cross-verify. Additional checks for methods like addEventListener
may be needed for older ones:
Messages are like people: It's essential to check their backgrounds
There's no such thing as too much security with postMessage
. Look before you leap:
Neatly closing windows
Don't forget to close your windows when you're done with them. Else, they risk catching a cold:
Was this article helpful?