开发者

IE9 "feature": turns oldie object/embed pair tags into single object tag, but it failed

开发者 https://www.devze.com 2023-03-17 02:07 出处:网络
I\'m working on a project which allowing end users to embed a flash in their own HTML pages while we offer different ways so user could choose one that works for their circumstances, for example, most

I'm working on a project which allowing end users to embed a flash in their own HTML pages while we offer different ways so user could choose one that works for their circumstances, for example, most blogs doesn't welcome users to inject JavaScript on their pages, therefore SWFObject wouldn't be possible, we offered two other ways: IFrame and the oldie but goodie Object/Embed pair. Just like old Youtube embedding code:

<object width="560" height="349">
    <param name="movie" value="http://www.youtube.com/v/rgyL08nhtkw?version=3&amp;hl=zh_TW"></param>
    <param name="allowFullScreen" value="true"></param>
    <param name="allowscriptaccess" value="always"></param>
        <embed src="http://www.youtube.com/v/rgyL08nhtkw?version=3&amp;hl=zh_TW" type="application/x-shockwave-flash" width="560" height="349" allowscriptaccess="always" allowfullscreen="true"></embed>
</object>

Somehow, the new IE9 turns tags above into this:

<object width="560" height="349" althtml="<embed src="http://www.youtube.com/v/rgyL08nhtkw?version=3&amp;hl=zh_TW" type="application/x-shockwave-flash" width="560" height="349" allowscriptaccess="always" allowfullscreen="true"></embed>">
    <param name="movie" value="http://www.youtube.com/v/rgyL08nhtkw?version=3&amp;hl=zh_TW"></param>
    <param name="allowFullScreen" value="true"></param>
    <param name="allowscriptaccess" value="always"></param>
</object>

As you can see, IE9 puts the embed part into an attribute called "althtml" in object tag, and the quote marks ruined the syntax, all flashvars and params after "althtml" is not w开发者_开发百科orking anymore.

I'm wondering is there any way to prevent IE9 to doing so? Is it safe to use object only and leave embed alone?


I think you misunderstand what's actually happening here. The "fallback" HTML that you've got inside the object tag (specifically the EMBED tag) isn't rendered unless the OBJECT tag fails to render. If the OBJECT tag fails to render, then the EMBED tag will render.

(Of course, because these two do the same thing, you'll end up with the same outcome; either the OBJECT will play or both the OBJECT and EMBED will both fail to play).


Well i dint get the reason for y the altHTML shows up in the object. But i found a work around. Hope it helps you.

Below link to my question.. which i answered myself :P

IE not retreving Flash Object src from Ajax response

0

精彩评论

暂无评论...
验证码 换一张
取 消