为什么Firefox不缓存swf对象?

时间:2010-08-07 06:01:22

标签: javascript swfobject

Iäm使用swf对象在我的网页上嵌入swf。在我的网页上的5-6个链接上显示相同的swf,但每次加载swf需要相同的时间,任何想法?

这是代码

var href = 'http://xyz.com/dialog/demo.swf';
var flashvars = {};
var params = {};
params.wmode = "transparent";
params.allowscriptaccess = "always";
params.swliveconnect = "true";
params.menu = "false";
var attributes = {};
attributes.id = "c2c";
attributes.name = "c2c";
swfobject.embedSWF(href+"?nocache="+siteID+"&phone="+num+"&siteid="+siteID, "infBox", "100", "60", "9.0.0", "http://xyz.com/dialog/expressInstall.swf", flashvars, params, attributes);

2 个答案:

答案 0 :(得分:2)

在代码的以下行中。你明确地让swfobject不要缓存你的电影。

swfobject.embedSWF(href+"?nocache="+siteID+"&phone="+num+"&siteid="+siteID, "infBox", "100", "60", "9.0.0", "http://xyz.com/dialog/expressInstall.swf", flashvars, params, attributes);

您需要删除或更新nocache变量。在你的代码中没有指定,但我确信var“num”是在代码中的某个地方随机化的。

建议1 - 完全删除缓存:

swfobject.embedSWF(href, "infBox", "100", "60", "9.0.0", "http://xyz.com/dialog/expressInstall.swf", flashvars, params, attributes);

解决方案2 - 仅从swf地址查询中删除num变量

swfobject.embedSWF(href+"?nocache="+siteID+"&phone="+"&siteid="+siteID, "infBox", "100", "60", "9.0.0", "http://xyz.com/dialog/expressInstall.swf", flashvars, params, attributes);

答案 1 :(得分:0)

尝试这种类型的代码

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="502" height="250">
    <param name="movie" value="swffile.swf" />
    <param name="quality" value="high" />
    <embed src="swffile.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="502" height="250"></embed>
  </object>

如果您在菜单insert-&gt; media-&gt; flash

中使用Dreamweaver作为编辑器,则可能会出现这种情况