postMessage() alternative for ie6/7 between iFrames and/or pop ups

时光毁灭记忆、已成空白 提交于 2019-12-08 08:10:04

问题


I am attempting to create a login button for web application which either loads an iFrame or a pop up window. Similar to that of Facebook login button. Im currently using the postMessage() method which works a treat.

However I know that it wont work in IE6/IE7 which I need to support. Is their any alternatives I could possibly use? or am I hoping for to much from the "awesome browser" that is IE6?


回答1:


Back in the day, I used to write IE6-based websites that opened popups and communicated between the popup and the original window.

So it can be done.

The browser provides a few objects you can use for this -- window.caller is the one you'll most likely want for passing calls back from the opened window to the original one, in addition to the object returned by the window.open() call, which you can use to pass calls from the original window back to the new one.

These two together will allow you to communicate in both directions.

You might also have some joy with jQuery, as I believe there are several plugins that wrap these methods in more friendly interfaces.

However, be aware that what you can do is a lot more limited in these older browsers than what's possible now, so even though you will be able to do to cross-window comms, you may find there are things you need that can't be done in older browsers.

Hope that helps.



来源:https://stackoverflow.com/questions/11121435/postmessage-alternative-for-ie6-7-between-iframes-and-or-pop-ups

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!