我按swfobject嵌入了swf文件。我不希望swf文件(它是广告)自动播放,所以我将play的属性设置为“false”。如下面的html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="swfobject/swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("myFlashContent", "9.0.0", "expressInstall.swf");
</script>
</head>
<body>
<div>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="970" height="250" id="myFlashContent">
<param name="movie" value="day_110702/ad.swf" />
<param name="play" value="false" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="day_110702/ad.swf" width="970" height="250">
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</body>
</html>
它在IE上完美运行,但在Chrome / Firefox上无效。在Chrome / Firefox中,swf文件会自动播放。
此外,swf文件的另一个行为与Chrome / Firefox不同,IE是: 当您使用不可见的iframe标记嵌入swf文件时。如
<iframe id="iframe" src="swf.html" style="width:100%;height:100%; display:none; visibility:hidden;"></iframe>
当您在IE / Firefox中浏览包含此iframe的页面时,在您使iframe可见之前,swf将不会播放。但是如果您在Chrome中浏览该页面,即使iframe不可见,swf也会自动播放。
任何人都可以告诉我为什么swf(flash)行为在不同浏览器中有所不同? 跨浏览器问题总是让人发疯:)。
答案 0 :(得分:0)
您是否尝试过使用动态发布而不是静态发布来嵌入SWF?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var flashvars = {};
var params = {};
params.play = "true";
var attributes = {};
swfobject.embedSWF("day_110702/ad.swf", "myAlternativeContent", "970", "250", "9.0.0", false, flashvars, params, attributes);
</script>
</head>
<body>
<div id="myAlternativeContent">
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
</div>
</body>
</html>