ie9:调试时出现恼人的弹出:“错误:'__flash__removeCallback'未定义”

时间:2021-03-13 04:57:01

I am working on a asp.net mvc site that uses facebook social widgets. Whenever I launch the debugger (ie9 is the browser) I get many error popups with: Error: '__flash__removeCallback' is undefined.

我正在使用facebook社交小部件的asp.net mvc网站上工作。每当我启动调试器(ie9是浏览器)时,我会收到许多错误弹出窗口:错误:'__flash__removeCallback'未定义。

To verify that my code was not responsible I just created a brand new asp.net mvc site and hit F5. If you navigate to this url: http://developers.facebook.com/docs/guides/web/#plugins you will see the pop-ups appearing.

为了验证我的代码不负责任,我刚刚创建了一个全新的asp.net mvc网站并点击了F5。如果您导航到此URL:http://developers.facebook.com/docs/guides/web/#plugins,您将看到弹出窗口出现。

When using other browsers the pop-up does not appear. I had been using the latest ie9 beta before updating to ie9 RTM yesterday and had not run into this issue.

使用其他浏览器时,弹出窗口不会出现。在昨天更新到ie9 RTM之前,我一直在使用最新的ie9 beta,并没有遇到这个问题。

As you can imagine it is extremely annoying... How can I stop those popups? Can someone else reproduce this?

你可以想象它非常烦人......我怎么能阻止那些弹出窗口?别人可以重现这个吗?

Thank you!

4 个解决方案

#1


2  

I can't seem to solve this either, but I can at least hide it for my users:

我似乎无法解决这个问题,但我至少可以为我的用户隐藏它:

$('#video iframe').attr('src', '').hide();
try {
    $('#video').remove();
} catch(ex) {}

The first line prevents the issue from screwing up the page; the second eats the error when jquery removes it from the DOM explicitly. In my case I was replacing the HTML of a container several parents above this tag and exposing this exception to the user until this fix.

第一行可以防止问题搞砸页面;当jquery明确地从DOM中删除它时,第二个吃错误。在我的情况下,我正在替换此标记上方的几个父项的容器的HTML,并将此异常暴露给用户,直到此修复。

#2


1  

I'm answering this as this drove me up the wall today.

我正在回答这个问题,因为今天我把它推到了墙上。

It's caused by flash, usually when you haven't put a unique id on your embed object so it selects the wrong element.

它是由flash引起的,通常是你没有在你的嵌入对象上放一个唯一的id,所以它选择了错误的元素。

The quickest (and best) way to solve this is to just:

解决这个问题的最快(最好)方法就是:

add a UNIQUE id to your embed/object

为嵌入/对象添加一个UNIQUE id

Now this doesn't always seem to solve it, I had one site where it just would not go away no matter what elements I set the id on (I suspect it was the video player I was asked to use by the client).

现在这似乎并不总能解决它,我有一个网站,它不会消失,无论我设置id的是什么元素(我怀疑它是我被客户端要求使用的视频播放器)。

This javascript code (using jQuery's on document load, replace with your favourite alternative) will get rid of it. Now this obviously won't remove the callback on certain elements. They must want to remove it for a reason, perhaps it will lead to a gradual memory leak on your site in javascript, but it's probably trivial.

这个javascript代码(使用jQuery的文档加载,替换为您最喜欢的替代)将摆脱它。现在这显然不会删除某些元素的回调。他们必须要删除它是出于某种原因,也许它会导致你的网站上的内存逐渐泄漏javascript,但这可能是微不足道的。

this is a secondary (and non-optimal) solution

这是次要(和非最佳)解决方案

    $(function () {
        setTimeout(function () {
            if (typeof __flash__removeCallback != "undefined") {
                __flash__removeCallback = __flash__removeCallback__replace;
            } else {
                setTimeout(arguments.callee, 50);
            }
        }, 50);
    });

    function __flash__removeCallback__replace(instance, name) {
        if(instance != null)
            instance[name] = null;
    }

#3


1  

I got the solution.

我得到了解决方案。

try {
  ytplayer.getIframe().src='';
} catch(ex) {
}

#4


0  

It's been over a months since I last needed to debug the project. Facebook has now fixed this issue. The annoying pop-up no longer shows up. I have not changed anything.

自从我上次需要调试项目以来已经过去了一个多月。 Facebook现在已经解决了这个问题。恼人的弹出窗口不再出现。我没有改变任何事情。

#1


2  

I can't seem to solve this either, but I can at least hide it for my users:

我似乎无法解决这个问题,但我至少可以为我的用户隐藏它:

$('#video iframe').attr('src', '').hide();
try {
    $('#video').remove();
} catch(ex) {}

The first line prevents the issue from screwing up the page; the second eats the error when jquery removes it from the DOM explicitly. In my case I was replacing the HTML of a container several parents above this tag and exposing this exception to the user until this fix.

第一行可以防止问题搞砸页面;当jquery明确地从DOM中删除它时,第二个吃错误。在我的情况下,我正在替换此标记上方的几个父项的容器的HTML,并将此异常暴露给用户,直到此修复。

#2


1  

I'm answering this as this drove me up the wall today.

我正在回答这个问题,因为今天我把它推到了墙上。

It's caused by flash, usually when you haven't put a unique id on your embed object so it selects the wrong element.

它是由flash引起的,通常是你没有在你的嵌入对象上放一个唯一的id,所以它选择了错误的元素。

The quickest (and best) way to solve this is to just:

解决这个问题的最快(最好)方法就是:

add a UNIQUE id to your embed/object

为嵌入/对象添加一个UNIQUE id

Now this doesn't always seem to solve it, I had one site where it just would not go away no matter what elements I set the id on (I suspect it was the video player I was asked to use by the client).

现在这似乎并不总能解决它,我有一个网站,它不会消失,无论我设置id的是什么元素(我怀疑它是我被客户端要求使用的视频播放器)。

This javascript code (using jQuery's on document load, replace with your favourite alternative) will get rid of it. Now this obviously won't remove the callback on certain elements. They must want to remove it for a reason, perhaps it will lead to a gradual memory leak on your site in javascript, but it's probably trivial.

这个javascript代码(使用jQuery的文档加载,替换为您最喜欢的替代)将摆脱它。现在这显然不会删除某些元素的回调。他们必须要删除它是出于某种原因,也许它会导致你的网站上的内存逐渐泄漏javascript,但这可能是微不足道的。

this is a secondary (and non-optimal) solution

这是次要(和非最佳)解决方案

    $(function () {
        setTimeout(function () {
            if (typeof __flash__removeCallback != "undefined") {
                __flash__removeCallback = __flash__removeCallback__replace;
            } else {
                setTimeout(arguments.callee, 50);
            }
        }, 50);
    });

    function __flash__removeCallback__replace(instance, name) {
        if(instance != null)
            instance[name] = null;
    }

#3


1  

I got the solution.

我得到了解决方案。

try {
  ytplayer.getIframe().src='';
} catch(ex) {
}

#4


0  

It's been over a months since I last needed to debug the project. Facebook has now fixed this issue. The annoying pop-up no longer shows up. I have not changed anything.

自从我上次需要调试项目以来已经过去了一个多月。 Facebook现在已经解决了这个问题。恼人的弹出窗口不再出现。我没有改变任何事情。