2011-08-03 40 views
0

我有一塊閃光的,不希望在Internet Explorer中發揮:如何在網絡瀏覽器上播放flash?

<div class="flash_slider">     
      <object style="visibility: visible;" id="flashcontent" data="/files/theme/piecemakerNoShadow.swf" type="application/x-shockwave-flash" height="460" width="980"> 
       <param value="transparent" name="wmode"> 
        <param value="xmlSource=/files/theme/piecemakerXML.xml&amp;cssSource=/files/theme/piecemakerXML.css&amp;imageSource=/files/theme/" name="flashvars"> 
      </object> 
        <script type="text/javascript"> 
         var flashvars = {}; 
         flashvars.xmlSource = "/files/theme/piecemakerXML.xml"; 
         flashvars.cssSource = "/files/theme/piecemakerXML.css"; 
         flashvars.imageSource = "/files/theme/"; 
         var attributes = {}; 
         attributes.wmode = "transparent"; 
         swfobject.embedSWF("/files/theme/piecemakerNoShadow.swf", "flashcontent", "980", "460", "10", "/files/theme/expressInstall.swf", flashvars, attributes); 
        </script>      
        </div> 

什麼想法? 謝謝

回答

1

目標IE使用條件註釋。

<!--[if !IE] > 
<script type = "text/javascript" > 
    var flashvars = {}; 
    flashvars.xmlSource = "/files/theme/piecemakerXML.xml"; 
    flashvars.cssSource = "/files/theme/piecemakerXML.css"; 
    flashvars.imageSource = "/files/theme/"; 
    var attributes = {}; 
    attributes.wmode = "transparent"; 
    swfobject.embedSWF("/files/theme/piecemakerNoShadow.swf", "flashcontent", "980", "460", "10", "/files/theme/expressInstall.swf", flashvars, attributes); 
</script> 
<![endif]--> 

當您通過SWFObject加載Flash時,它將確保您的腳本不會在IE中運行。

也嘗試瀏覽器嗅探。 (不推薦,但我沒有看到這裏任何其他方式)

var isMSIE = /*@[email protected]*/false; 
if(!isMSIE){ 
    var flashvars = {}; 
    flashvars.xmlSource = "/files/theme/piecemakerXML.xml"; 
    flashvars.cssSource = "/files/theme/piecemakerXML.css"; 
    flashvars.imageSource = "/files/theme/"; 
    var attributes = {}; 
    attributes.wmode = "transparent"; 
    swfobject.embedSWF("/files/theme/piecemakerNoShadow.swf", "flashcontent", "980", "460", "10", "/files/theme/expressInstall.swf", flashvars, attributes); 

} 

如果還是不行,請嘗試

var isMSIE = navigator.appName === 'Microsoft Internet Explorer'; 

這可以幫助你:http://pipwerks.com/2011/05/18/sniffing-internet-explorer-via-javascript/

+0

對不起,那沒做技巧 – Patrioticcow

+0

仍然不起作用,這是非常有線 – Patrioticcow

+0

再次更新。這是我所能提供的:) – naveen

相關問題