本文介绍了在IE8中通过javascript删除嵌入式YouTube视频时出现黑屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此代码让用户在我正在构建的网站上嵌入youtube视频:

I use this code to let users embed youtube videos on a website i am building:

function BuildYoutubePlayer(youtubeVideoId, width, height) {
    youtubePlayer = "<iframe ";
    youtubePlayer += "width=\"" + width + "\" ";
    youtubePlayer += "height=\"" + height + "\" ";
    youtubePlayer += "src=\"http://www.youtube.com/embed/" + youtubeVideoId + "\"&amp;wmode=transparent ";
    youtubePlayer += "frameborder=\"0\" allowfullscreen>";
    youtubePlayer += "</iframe>";

    return youtubePlayer;
}

当用户关闭此嵌入时,此嵌入将作为灯箱弹出窗口位于图层中弹出窗口,视频从html中删除,但我在IE8上得到一个黑色全屏,我找不到任何理由,我尝试嵌入youtube视频并删除它,它工作正常,所以我肯定错过了一些东西。请建议。

This embed will be in a layer as lightbox popup, when the user closes this popup, the video removed from the html, but I get a black full screen just on IE8, I can't find any reason, I tried embedding youtube video and removing it, and it worked fine, so sure I am missing something. please advice.

推荐答案

我通过在移除父弹出窗口之前隐藏iFrame来解决这个问题。

所以我说 $('iframe')。hide(); 然后 $('myContainerPopup')。remove();

I solved that by hiding the iFrame before removing it while removing the parent popup.
So I say $('iframe').hide(); then $('myContainerPopup').remove();

我在IE8和youtube视频上遇到了这个问题,没有在IE7上测试,但是在所有其他浏览器上都运行正常。

I faced this problem just on IE8 and youtube videos, didn't test on IE7 but on all other browsers things were working fine.

这篇关于在IE8中通过javascript删除嵌入式YouTube视频时出现黑屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 06:48