• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1114
  • Last Modified:

Show image if flash is disabled

I've tried using a regular <img> tag, as well as the <asp:image> tag, but neither one works.

What is the smartest way to handle this?

<div class="productGroupTop">
        <asp:HyperLink id="linkage" runat="server">
	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="800" height="616" id="RoomImage" align="middle">
	<param name="allowScriptAccess" value="sameDomain" />
	<param name="allowFullScreen" value="false" />
	<param name="movie" value="<%= Page.ResolveUrl("~") %>flash/RoomImage.swf" />
	<param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	
	<param name="wmode" value="transparent" />
	<embed src="<%= Page.ResolveUrl("~") %>flash/RoomImage.swf"  wmode="transaprent" quality="high" bgcolor="#ffffff" width="800" height="616" name="RoomImage" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
	<asp:Image ID="imgGroupHero" Height="616px" Width="800px" runat="server" AlternateText="no flash" />

Open in new window

2 Solutions

Use a javascript function that detect if Flash is enabled on the browser.

to do so you can use his framework:

<script type="text/javascript"> 
		alert("Flash is required to enjoy this site.");     	
		alert("Flash is insalled on your Web browser.");

Open in new window

I recommend using SWFObject to embed your SWF

the snippet below shows how to do what you need. Basically the alternate content (in your case an image) is replaced at runtime with the SWF if the flash player is detected

documentation is here:

<!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">
    <title>SWFObject dynamic embed - step 3</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">
    swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0");
    <div id="myContent">
      <p>Alternative content -- PUT YOUR ALTERNATE IMAGE HERE</p>

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now