What are all the browsers that support the window.postMessage
call now? I am looking for browsers that support it natively, not through an iFrame hack.

- 21,989
- 3
- 55
- 63

- 18,135
- 25
- 89
- 129
5 Answers
Can I use cross-document messaging
FF3+, IE8+, Chrome, Safari(5?), Opera10+

- 166,823
- 56
- 351
- 396
-
35Note that IE8/9 only support strings for the data argument, whereas all other browsers support objects. – Brandon Gano Jun 04 '13 at 04:41
-
1@Brando: You comment just saved my day. I thought I would be hours trying to figure out why IE wasn't working; but lo, I am sending an object. – Lawrence Dol Sep 01 '13 at 16:05
-
4old post but you can send json (sting) and use eval to decode object – ElSinus Jun 24 '14 at 13:02
-
8@ElSinus I'd avoid eval. I'd recommend using a combination of JSON.stringify and JSON.parse – Darwayne Aug 14 '14 at 17:37
IE8 does not allow postMessage across windows/tabs
for more info check here

- 1,601
- 4
- 18
- 36
-
Nice for pointing that out! I didn't even know it works across windowws/tabs in other browsers >_> – Raynos May 17 '11 at 20:29
-
-
The postMessage() API now has asynchronous behavior for IE9 mode pages. This article http://blogs.msdn.com/b/ieinternals/archive/2009/09/16/bugs-in-ie8-support-for-html5-postmessage-sessionstorage-and-localstorage.aspx explains the problems still arising in IE9 not sure if it has been corrected yet though. – Keith Beard Aug 05 '11 at 14:36
postMessage is supported in IE8+ HOWEVER
- Remember that IE9 and below require data to be passed in string form and not as an object.
- IE doesn't like you to call
postMessage
as soon as page loads (I'm assuming this has to do with the iframe you are posting to needing time to load).
Use asetTimeout
to wait one or two seconds before callingpostMessage
.
It took me hours to figure this out and IE wasn't giving me any error message, it was just silently doing nothing until I added the setTimeout.
If you want to start with a demo which actually does work in IE, check out this nifty tutorial by Ilya Kantor
For what it's worth recently I ran into some odd webkit browser/versions out in the wild that did NOT support postMessage. I was using IE(8) detection as my means for seeking an alternative. Instead, I probably should have just done some something like this:
if(window.postMessage){
console.log('Supports post message');
}
Or likely a bit cleaner:
var pm_is_supported = typeof(window.postMessage) == 'function';

- 493
- 6
- 12
-
Thanks, this is good stuff. It's not an answer to the question though and should be a comment. – Niklas Berglund Apr 08 '14 at 08:19
-
Your cleaner solution does not work in IE8. In IE8 window.postMessage comes back as an object – KingOfHypocrites May 25 '14 at 15:14
-
All latest browsers supports that e.g. IE 11, Edge, Firefox 57+, Dafari 11+, iOS Safari 10.2+, Opera mini, Chrome for android, UC Browser etc.
https://caniuse.com/#search=document%20messaging

- 3,553
- 1
- 27
- 26