Providing alternative images if Adobe Flash isn't available

前端 未结 6 1279
我寻月下人不归
我寻月下人不归 2020-12-24 14:09

Are there any ways providing an alternate GIF/PNG image, in case the user has no Adobe Flash installed and/or deactivated. I’ve found recommendations, like the following fro

相关标签:
6条回答
  • 2020-12-24 14:45

    I use the following code for graceful degradation. It works well.

    <!--[if !IE]> -->
    <object type="application/x-shockwave-flash" data="flash.swf" width="500" height="100">
    <!-- <![endif]-->
    
    <!--[if IE]>
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
        codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" 
        width="500" height="100">
      <param name="movie" value="flash.swf" />
    <!--><!--dgx-->
      <param name="loop" value="false">
      <param name="menu" value="false">
      <param name="quality" value="high">
      <img src="flash_replacement.png" width="500" height="100" alt="No Flash">
    </object>
    <!-- <![endif]-->
    
    0 讨论(0)
  • Actually having flash installed but javascript turned off is a valid scenario. This should work across most browsers:

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="600" id="flashContent">
      <param name="movie" value="flash.swf" />
      <!--[if !IE]>-->
        <object type="application/x-shockwave-flash" data="flash.swf" width="800" height="600">
      <!--<![endif]-->
          <img src="(...)" alt="Put your alternate content here" />
      <!--[if !IE]>-->
        </object>
      <!--<![endif]-->
    </object>
    
    0 讨论(0)
  • 2020-12-24 14:59

    We can provide an alternate GIF/PNG image, in case the user has no Adobe Flash installed and/or deactivated.

    <object id="flashcontent classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="550px" height="400px">
    <param name="movie" value="mymovie.swf" />
    
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="mymovie.swf" width="550px" height="400px">
    <!--<![endif]-->
    
    <p>
    Fallback or 'alternate' content goes here.
    This content will only be visible if the SWF fails to load.
    </p>
    
    <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
    
    </object>
    

    And also add this...

    <script type="text/javascript">
    swfobject.registerObject("flashcontent", "9", "/path/to/expressinstall.swf");   
    </script>
    
    0 讨论(0)
  • 2020-12-24 15:04

    I find using inline styling to do the trick.

    For example:

    <div style="background-image: url('...');">
        <object>
         /* Embedded Flash */
        </object>
    </div>
    
    0 讨论(0)
  • 2020-12-24 15:12

    I don't know why you want to avoid javascript, it is the best solution when dealing with Flash.

    using the SWFObjects Library (the best known so far for the matter) you can do this:

    <!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"> 
    <head> 
     <title> My Home Page </title> 
     <meta name="viewport" content="width=780"> 
     <script type="text/javascript" src="swfobject.js"></script> 
    </head> 
    <body> 
     <div id="splashintro"> 
       <a href="more.html"><img src="splash_noflash.png" /></a> 
     </div>
     <script type="text/javascript"> 
       var so = new SWFObject("csplash.swf", "my_intro", "300", "240", "8", "#338899"); 
       so.write("splashintro"); 
     </script> 
     </body> 
    </html>
    

    what the script does is replace the splashintro div with the flash file, if the browser does not support Flash, then does nothing and the splash_noflash.png will be shown.

    P.S. With this technique you are ready for the iPhone, instead of showing the blue cube, it will show the image :)

    0 讨论(0)
  • 2020-12-24 15:12

    I have written an easy way to do this in CSS - no extra JavaScript at all.

    Name your ID/Class where your Flash movie resides and use a background image. Wrap your Flash movie within that div.

    For example:

    <div ID="MyFlashMovie"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="600" id="flashContent">
      <param name="movie" value="flashMovie.swf" />... etc., etc.</object>
    </div> etc.
    

    Then in your CSS:

    #MyFlashMovie {
    background: url("alternateGraphic.png");
    background-repeat: no-repeat;
    height: XXpx;
    width: XXpx;
    }
    

    When the Flash isn't available, say on the iphone/pad, the graphic will display. The only drawback with this, that I have found, is that if your Flash movie uses a transparent background, you will see the alt graphic through the transitions. Just make a solid color within the Flash movie as your lowest layer (make sure it's the same bg color as the website) and it will look fine.

    ~GreaseJunkie

    0 讨论(0)
提交回复
热议问题