在 Safari 中使用ExternalInterface 从 AS3 打开弹出窗口
我使用此代码为 JavaScript 人员打开一个弹出窗口
ExternalInterface.call("function () { window.open('" + url + "','" + title + "','" + options + "'); }");
:从 Flash 播放器调用 ExternalInterface.call(string);
让浏览器执行 eval(string) ();
由于此调用是在单击处理程序中进行的,因此它甚至可以与 Firefox 和 IE 完美配合,对于 Opera,它可以让您手动打开弹出窗口。 但在 Safari 中,它总是被静默阻止。有人知道如何规避这个问题吗?
谢谢
back2dos
I'm using this code to open a popup
ExternalInterface.call("function () { window.open('" + url + "','" + title + "','" + options + "'); }");
for JavaScript people: calling ExternalInterface.call(string);
from flash player lets the browser do eval(string)();
as this call is within a click handler, it even works perfectly with Firefox and IE, for Opera it lets you open the popup manually.
But in Safari, it is always blocked silently. Anyone have an idea how circumvent this?
thanks
back2dos
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到过这个问题,据我所知没有真正的解决方案...我能找到的唯一解决方法本质上是检查 window.open 是否有效,以及如果它不使用 navigatorToURL 代替...我刚刚发现这个链接可以更好地解释这一点:
http:// www.asserttrue.com/articles/2007/08/22/workaround-for-safari-blocking-flash-initerated-pop-ups
I've run into this, and as far as I could tell there was no real solution... the only workaround I could find was essentially checking if window.open works, and if it doesn't use navigateToURL instead... I just found this link that explains this much better:
http://www.asserttrue.com/articles/2007/08/22/workaround-for-safari-blocking-flash-initiated-pop-ups
您不应该在 AS3 内部创建函数。这可能是您出现不良行为的原因之一。
您应该在 HTML 或 JS 文件中创建函数并使用 EI 调用它,并传递您需要的参数。
You shouldn't be creating your function inside of AS3. That's probably one of the reasons you are getting bad behavior.
You should create your function in the HTML or JS files and call it with EI, and pass the arguments you need.