开发者

Object Fallback Optimization

I have an object loading a flash animation with an image as a fallback.

When I look at the resources being loaded on page load, the fallback image appears to be downloaded regardless of whether or not flash is detected, which seems to be wasteful and inefficient (especially if the fallback image is large).

What's a clean way to ensure the fallback image isn't loaded if the object tag detects flash?

I've already looked at the get_browser() PHP function and it doesn't appear to be a viable option.

He开发者_C百科re's a code outline:

<object>
  <param name="movie" value="..." />
  <param name="play" value="true" />
    <div id="frontpagefallback">    
      <img src="..." width="..." alt="..." usemap="#homeMap" />
    </div>
</object>


I'm assuming that you have this image in place in the div or whatever, and that you repopulate this div with the Flash content, if Flash is available. If so, yes, the behavior you are seeing is normal.

What you need to do is determine in Javascript if Flash is installed, and then decide whether to populate that div with the image content, or the Flash content. How you do this depends on how you are loading the flash. I believe SWFObject can do this for you.

Generally though, it is fine to put that image there by default. What if someone loads your page that isn't capable of running your Javascript to detect flash? What about non-browsers on your page, such as search engines?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜