iMrames和/或弹出窗口之间的ie6 / 7的postMessage()替代方案 [英] postMessage() alternative for ie6/7 between iFrames and/or pop ups

查看:176
本文介绍了iMrames和/或弹出窗口之间的ie6 / 7的postMessage()替代方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为Web应用程序创建一个登录按钮,该按钮可以加载iFrame或弹出窗口。类似于Facebook登录按钮。我目前正在使用postMessage()方法,它可以处理。



但是我知道它在我需要支持的IE6 / IE7中不起作用。他们可以使用他们的任何替代品吗?或者我希望从IE6的真棒浏览器中获得更多?

解决方案

在当天,我曾经编写基于IE6的网站,打开弹出窗口并在弹出窗口和原始窗口之间进行通信。



所以可以完成。



浏览器提供了一些可用于此目的的对象 - window.caller 是您最有可能从打开的窗口传回回调的对象除了 window.open()调用返回的对象之外,还可以使用它来将原始窗口中的调用传递回新窗口。



这两个一起允许你在两个方向上进行交流。



你可能也对jQuery感到高兴,我相信有几个插件可以将这些方法包装在更友好的界面中。



但是,请注意,在这些旧版浏览器中,您可以做的更多限制那又如何现在是可能的,所以即使你能够做到跨窗通信,你可能会发现你需要的东西在旧浏览器中无法完成。



<希望有所帮助。


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?

解决方案

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.

这篇关于iMrames和/或弹出窗口之间的ie6 / 7的postMessage()替代方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆