开发者

swfobject.embedSWF doesn't load objects in IE7 and IE8

开发者 https://www.devze.com 2023-02-05 08:53 出处:网络
I have this code running great in ff, opera and chrome: <script type=\"text/javascript\"> $(document).ready(function(){

I have this code running great in ff, opera and chrome:

<script type="text/javascript">
                    $(document).ready(function(){
                      var swfUrl = "http://www.youtube.com/apiplayer?video_id=<?php echo bg_get_video_id($post->post_content)?>&enablejsapi=1&version=3&playerapiid=ytplayer_<?php echo $i?>";


                      // allowScriptAccess must be set to allow the Javascript from one 
                      // domain to access the swf on the youtube domain
                      var params = { allowScriptAccess: "always", wmode: "opaque" };

                      // This sets the ID of the DOM object or embed tag to 'myytplayer'.
                      // You can use this ID to access the swf and call the player's API
                      var atts = { id: "ytplayer_<?php echo $i?>", class: "ytplayer"};
                      var flashvars = {};
                      swfobject.embedSWF(swfUrl, "ytdiv_<?php echo $i?>", "300", "120", "9", null, flashvars, params, atts);
                    });
                </script>   

But not in Internet Explorer versions 7 and 8. It's a part of php file from Wordpress, but it's not important - video_id and ytdiv_ are all ok, it works in other browsers.

Is there anything I can开发者_开发技巧 do to make it work in IE? I don't have any ideas about what could have caused it.

Cheers, Nebril


Here:
var atts = { id: "ytplayer_", "class": "ytplayer"};

Type in quotes "class" and you are done. It helped me at least.


I don't know whether it's the same problem I had, but I had to upgrade to the latest version of swfobject, 2.2 I think it is now, that solved it for me.

0

精彩评论

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

关注公众号