简体   繁体   English

动态添加到IE中的DOM时,Flash对象不起作用

[英]Flash object doesn't work when dynamically added to the DOM in IE

I am doing an ajax request with jQuery that returns some html and then I am inserting that html into the DOM. 我正在用jQuery返回一个html的ajax请求,然后将那个html插入DOM。 The HTML is as follows: HTML如下:

    <div class="entry-details">
            <div class="brightcove-player-wrap">
        <!-- Start of Brightcove Player -->
            <div style="display:none">
            </div>
            <!--
            By use of this code snippet, I agree to the Brightcove Publisher T and C
            found at https://accounts.brightcove.com/en/terms-and-conditions/.
            -->
            <script language="JavaScript" type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>
            <object id="myExperience4733627893001" class="BrightcoveExperience">
              <param name="bgcolor" value="#FFFFFF" />
              <param name="width" value="1130" />
              <param name="height" value="500" />
              <param name="playerID" value="4732606104001" />
              <param name="playerKey" value="AQ~~,AAABAzMvv-k~,LozjqgbLEy1mFJ0QaG0FQ_ctTc2aT68o" />
              <param name="isVid" value="true" />
              <param name="isUI" value="true" />
              <param name="dynamicStreaming" value="true" />

              <param name="@videoPlayer" value="4733627893001" />
            </object>
            <!--
            This script tag will cause the Brightcove Players defined above it to be created as soon
            as the line is read by the browser. If you wish to have the player instantiated only after
            the rest of the HTML is processed and the page load is complete, remove the line.
            -->
            <script type="text/javascript">brightcove.createExperiences();</script>
            <!-- End of Brightcove Player -->
        </div>
        <div class="entry-like">
        <a href="" data-entry-id="291" class="btn btn-lime">Like <i class="icon-thumbs-up"></i></a>
    </div>
    <div class="entry-intro">
        <span>Submitted by:</span> Geoff Meierhans<br>
                <span>Location:</span> United Kingdom<br>
        <span>Likes:</span> 0    </div>

    <br>
    <div class="question-1">
        <h4>What message would you like to give to lung cancer patients?</h4>
        <p>This is my message</p>
    </div>

    <br>
    <div class="request-removal">
        <a href="http://local.tagrisso.com/request_removal/291" class="btn btn-mulberry">Request Removal <i class="icon-remove icon-white"></i></a>
    </div>
</div>

This works fine in chrome but not in any version of IE. 这在chrome中可以正常使用,但在任何版本的IE中都不能正常运行。 If the object is already on the page when the page loads it works fine and the video plays but when I insert it dynamically with jQuery the video doesn't appear in IE. 如果该对象在页面加载时已经在页面上,则可以正常工作并且可以播放视频,但是当我使用jQuery动态插入该对象时,该视频不会出现在IE中。

Could not complete the operation due to error 80020101

Here is the jQuery I am using with version 1.9.1 of jQuery: 这是我在jQuery 1.9.1版中使用的jQuery:

var request = $.ajax({
    url: "user/get_message",
    method: "POST",
    data: { id : entryId },
    dataType: "html",
    cache: false
});

request.done(function(html) {
    $('#entry-info').html(html);
});

Anyone know why this is happening and what the fix might be? 任何人都知道为什么会发生这种情况以及可能的解决方法是什么?

UPDATE UPDATE

I managed to fix it in IE8 and upwards by including the brightcove js file on page load rather than dynamically. 我设法通过在页面加载中而不是动态地包含Brightcove js文件在IE8及更高版本中对其进行了修复。 So move the following line from the ajax response into the main DOM: 因此,将以下行从ajax响应移至主DOM:

<script language="JavaScript" type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>

It still doesn't work in IE7 though, anyone know why? 但是,它仍然无法在IE7中运行,有人知道为什么吗?

最后,我必须创建一个仅包含视频的空白页面,然后动态添加一个显示该视频的iframe。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM