【问题标题】:iframe video object doesn't get loaded on Chrome, the same gets loaded in IE and FFiframe 视频对象未在 Chrome 上加载,在 IE 和 FF 中加载相同
【发布时间】:2013-10-31 00:18:54
【问题描述】:

iframe 视频对象不会在 Chrome 上加载,同样会在 IE 和 FF 中加载。研究并尝试了很多来解决这个问题;但是到目前为止还没有取得任何成功。请在下面找到我使用的代码并帮助解决问题。

<div id="videoget" style="width:800px !important; height:300px !important;">
<script>
if(document.URL.indexOf("video-id") == -1){
    document.write("<img style='margin:150px 400px 150px 400px !important;' height=20  width=20 src=/ajax-loader.gif>
<iframe src='gpage/video-id/9yZnYzYTuyeruyuweyruweyuryuewy'width=0 height=0></iframe>"); 
}
</script>
</div>

<style>
object {
width: 800px !important;
height: 334px !important;
}
#videoget{
margin-top:15px;
margin-bottom:50px;
}
</style>








 jQuery(function () {
    setTimeout(function () {
        var iframenew = document.frames;
        if(iframenew == null){
        jQuery(function () {
                 var timerId = setInterval(function () {
                 var iframeano = window.frames; 


                 if(iframeano!=null) { 
                       var video1 = jQuery('iframe').contents().find('object').last();;
                       jQuery('#videoget',top.document).html(video1); 
                       clearInterval(timerId);
                                     } else {}
                                                       },5000);
               });

        }
        else
        {
           var video = jQuery('iframe').contents().find('object').last();;
           jQuery('#videoget').html(video);
        }





    }, 5000);
});

【问题讨论】:

    标签: jquery google-chrome object iframe video


    【解决方案1】:

    没有检查你的脚本在做什么,但你有一些奇怪的东西,我可能这已经做好了......

    jQuery(function () { //<-- this is enough
        setTimeout(function () {
            var iframenew = document.frames;
            if(iframenew == null){
                //jQuery(function () { //<-- no need for that again...
                var timerId = setInterval(function () {
                        var iframeano = window.frames; 
                        if(iframeano!=null) { 
                              var video1 = jQuery('iframe').contents().find('object').last(); //; <-- only 1 
                              jQuery('#videoget',top.document).html(video1); 
                              clearInterval(timerId);
                        }  //else {} <-- no need for else here...
                    },5000);
                //});
            }
            else
            {
               var video = jQuery('iframe').contents().find('object').last(); //;<-- only 1 
               jQuery('#videoget').html(video);
            }
        }, 5000);
    });
    

    【讨论】:

    • 这在 IE 和 FF 上运行良好,只是当我尝试在 Chrome 上这样做时,它失败了。虽然我做了建议的更改,但还没有成功。
    • 也许你可以做一个小提琴,所以我可以在 chrome 上测试一下?
    • 它在 Chrome 中显示的错误/警告与我在 IE 和 FF 中看到的类似。我认为,实际上需要一种解决方法来渲染 iframe,然后将其视频对象加载到 Chrome 上。谢谢!!
    猜你喜欢
    • 2012-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-30
    • 2014-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多