当IFRAME在Chrome已加载“加载”事件不触发 [英] 'load' event not firing when iframe is loaded in Chrome

查看:1367
本文介绍了当IFRAME在Chrome已加载“加载”事件不触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想,而一个文件是动态生成的服务器端我的客户端上显示一个面具。好像推荐工作围绕这个(因为它不是阿贾克斯)是使用一个iframe,从onload事件监听或做的事件来确定该文件实际上已经运到客户端从服务器。

I am trying to display a 'mask' on my client while a file is dynamically generated server side. Seems like the recommend work around for this (since its not ajax) is to use an iframe and listen from the onload or done event to determine when the file has actually shipped to the client from the server.

这是我的角度code:

here is my angular code:

    var url = // url to my api
    var e = angular.element("<iframe style='display:none' src=" + url + "></iframe>");
    e.load(function() {
        $scope.$apply(function() {
            $scope.exporting = false;  // this will remove the mask/spinner
        });
    });
    angular.element('body').append(e);

这在Firefox很大,但在Chrome没有运气。我也曾尝试使用的onload功能:

This works great in Firefox but no luck in Chrome. I have also tried to use the onload function:

e.onload = function()  { //unmask here }

但我没有任何运气有两种。

But I did not have any luck there either.

想法?

推荐答案

不幸的是不可能的,如果内容是附着在Chrome中使用一个iframe的的onload 事件。这回答可以为你提供了一个如何解决它的想法。

Unfortunately it is not possible to use an iframe's onload event in Chrome if the content is an attachment. This answer may provide you with an idea of how you can work around it.

有关被解雇了哪些事件的更多信息,可以发现<一个href=\"http://www.atalasoft.com/cs/blogs/jake/archive/2009/06/18/events-to-expect-when-dynamically-loading-iframes-in-javascript.aspx\"相对=nofollow>这里。

More information about what events are fired can be found here.

这篇关于当IFRAME在Chrome已加载“加载”事件不触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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