diff --git a/jquery.ba-postmessage.js b/jquery.ba-postmessage.js index 5c0fbfe..2203810 100644 --- a/jquery.ba-postmessage.js +++ b/jquery.ba-postmessage.js @@ -109,8 +109,9 @@ if ( has_postMessage ) { // The browser supports window.postMessage, so call it with a targetOrigin // set appropriately, based on the target_url parameter. - target[postMessage]( message, target_url.replace( /([^:]+:\/\/[^\/]+).*/, '$1' ) ); - + window.setTimeout(function() { + target[postMessage]( message, target_url.replace( /([^:]+:\/\/[^\/]+).*/, '$1' ) ); + }, 0); } else if ( target_url ) { // The browser does not support window.postMessage, so set the location // of the target to target_url#message. A bit ugly, but it works! A cache