Sunday, June 16, 2013

postMessage only works for IFRAMES/FRAMES in IE9

http://blogs.msdn.com/b/ieinternals/archive/2009/09/16/bugs-in-ie8-support-for-html5-postmessage-sessionstorage-and-localstorage.aspx

From this blog, the limitation of IE9 postMessage implementation impacts cross window/tab communications, at least for this windows browser. Firefox, Chrome, Safari, Opera seem to implement well. Through postMessage and onMessage interfaces, it is a convenient, efficient and secure way to do cross window/tab/frame communications, even cross domains.

Though parent and child window can easily access eachother’s DOM, a common way to get a value from one window to another is by setting a value on a hidden input field of a form in the other window. Therefore, the solution is adding a form to your page and using hidden form elements to transfer data back and forth between windows.

Here is one jquery plugin which encapsulates all the form building, event handler details.
http://www.sfpeter.com/2008/03/communication-between-browser-windows-with-jquery-my-new-plugin/

1 comment:

  1. http://blogs.msdn.com/b/ieinternals/archive/2009/09/16/bugs-in-ie8-support-for-html5-postmessage-sessionstorage-and-localstorage.aspx
    http://www.debugtheweb.com/test/xdm/origin/
    This gives better explanation about how to handle cross domain messaging in IE9, with proxy iframe for popup window.

    ReplyDelete