jQuery Flash Plugin

A jQuery plugin for embedding Flash movies.

  1. Features

    1. Simple, but powerful.

      Specify what you need, and nothing more -- sensible defaults take care of the rest.

      $('#hello').flash({
          src: 'hello.swf',
          width: 320,
          height: 240
      });
      

      Perform sophisticated replacements by passing a custom callback.

      $('.custom').flash(null, null, function(htmlOptions){
          // do stuff
      });
      

      Overwrite the defaults to always to meet your needs.

      $.fn.flash.replace = function(htmlOptions) {
          // always do stuff
      };
      
    2. Flash Detection, Express Install and more.

      Detect specific major, minor and revision versions of the Flash plugin.

      $('#hello').flash(
          { src: 'hello.swf' }, 
          { version: '6.0.65' }
      );

      Use Express Install, or show an update message if Flash isn't installed.

      $('#hello').flash(
          { src: 'hello.swf' }, 
          { expressInstall: true }
      );

      Or, degrade silently and gracefully.

      $('#hello').flash(
          { src: 'hello.swf' }, 
          { update: false }
      );

      Bypass Flash detection, just in case.

      <a href="page.html?hasFlash=true">I have Flash!</a>
    3. Accessible and Unobtrusive.

      Pages are progressively enhanced when Flash and Javascript are available, and fallback to plain (X)HTML when they're not — like search-engines, pdas or mobile phones. Replacements can happen as soon as the dom is ready. (X)HTML, CSS and Javascript stay where they belong — away from one another — making it easy to remove, update or swap out down the road.

      $(document).ready(function(){
          $('#hello').flash({
              src: 'hello.swf'
          });
      });
      
    4. Native and light-weight.

      Inspired by tools like SWFObject, UFO and sIFR, but written line-by-line for jQuery — no other scripts required. Less redundancy (jQuery and sIFR both find elements by css selectors and do browser detection, sIFR and SWFObject both do Flash detection) means smaller filesize and faster loading.

  2. Examples

  3. FAQ

    Which browsers are supported?
    Internet Explorer 5.5/6.0/7.0
    FireFox 1.5/2.0
    Safari 2.0
    Opera 9.0
    Why isn't ActiveX control activation in Internet Explorer working?
    The packed version of jQuery breaks ActiveX control activation, see: known issues.
  4. Known Issues

    Problem:
    Using the packed version of jQuery breaks ActiveX control activation in Internet Explorer. To avoid manual activation, Flash movies (and other ActiveX controls) must be inserted by an external script. The packed version of jQuery is a string, which the browser unpacks using eval(). Internet Explorer doesn't think the jQuery object (unpacked in the eval) is “external”, which breaks the workaround. If anyone knows of a /packer/-compatible solution, I'm all ears! See: jQuery/Packer/ActiveX Bug for more info.
    Workaround:
    Use JSMin to minify jQuery. Apply a simple patch to the uncompressed version of jQuery and then pack it. Use the minified version of jQuery instead of the packed version.
    Problem:
    When using the imagebox plugin on the same page as a swf embeded with jQuery.flash, the swf disappears when the imagebox opens, and doesn't reappear when the imagebox is closed. I haven't had time to test it myself.
    Workaround:
    None
    Problem:
    Embed tag attributes are converted to lower case, which seems to be a problem with jQuery's DOM insertion methods (i.e. .html(), .prepend(), etc.)
    Workaround:
    Write a custom replace method that uses innerHTML instead of .prepend()
  5. Version History