是什么触发了 ie 中对象标签的 onerror 事件处理程序?

发布于 2024-11-26 19:44:27 字数 687 浏览 3 评论 0原文

我们一直在对一些嵌入式 Flash 小部件进行一些测试。

虽然我知道 onerror 事件,当附加到 对象标签 时,跨浏览器不太友好,但我们为 Internet Explorer 用户调用了这个处理程序。

虽然我非常确定当 swf 无法加载时(如 404、410、网络错误等)会调用此处理程序,但在其他情况下是否会调用它?

由于这些小部件不是我们自己的,是否可以从嵌入的 Flash 文件中“抛出”onerror 事件?如果是这样,这可能就是我们看到这种情况的原因。

我想我也应该把这个也扔进去,是否有可能获得任何额外的信息来说明是什么导致 onerror 事件在被调用时被调用?

总而言之,我们正在寻找的是了解天气情况,可以安全地假设如果从对象标记触发 onerror 事件,则该事件被触发是因为 swf 未成功加载,因此我们可以尝试从另一个网址。是的,如果由于其他原因触发了 onerror 然后 swf 无法加载,我们只是不想尝试重新加载 swf。

一些附加信息:

我们正在使用嵌入 flash 的 flash satay 方法。并简单地将 onerror 添加到对象标记,如下所示:

<object .... onerror="ourAjaxLogFunction()">

一如既往,谢谢您。

we have been doing some testing on some embeded flash widgets.

while i know the onerror event, when attached to a object tag is not very cross browser friendly, we are getting this handler called quite a bit for internet explorer users.

while i am quite sure this handler will be called when the swf cannot be loaded (as in, 404, 410, network error, etc), is it called in any other circumstances?

as these widgets are not our own, is it possible to 'throw' an onerror event from within the embeded flash file? if so, this could be why we are seeing this.

i guess i should throw this in as well, is it possible to get any additional information as to what caused the onerror event to be called when it is called?

to summarize, what we are looking for is to know weather it is safe to assume that IF an onerror event is fired from an object tag, that it was fired because the swf did not load successfully, and thus we can attempt to load it from another url. yea, we just don't want to try reloading the swf if onerror was fired for some OTHER reason then the swf failing to load.

some additional information:

we are using the flash satay method of embeding flash. and simply adding the onerror to the object tag, as follows:

<object .... onerror="ourAjaxLogFunction()">

as always, thank you kindly.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怪异←思 2024-12-03 19:44:27

onerror 的文档说(强调我的):

要调用,请导致发生以下错误之一:

  • 运行时脚本错误,例如无效的对象引用
    安全违规

  • 下载对象(例如图像)时出错。

  • Internet Explorer 9 的新增功能。出现错误
    获取媒体数据时。

也许您的 Flash 内容正在尝试跨越某种安全边界。如果是这种情况,尝试从其他来源重新加载它不会有帮助。我建议您对传递给处理程序的错误消息进行进一步调查。

The documentation for onerror says (emphasis mine):

To invoke, cause one of the following errors to occur:

  • Run-time script error, such as an invalid object reference or
    security violation
    .

  • Error while downloading an object, such as an image.

  • New for Internet Explorer 9. An error occurs
    while fetching media data.

Maybe your Flash content is trying to cross a security boundary of some kind. If that's the case, trying to reload it from another source won't help things. I'd suggest you perform further investigations on the error messages passed to your handler.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文