Specify what you need, and nothing more -- sensible defaults take care of the rest.
$('#hello').flash({ src: 'hello.swf', , });
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 };
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 class="page.html?hasFlash=true">I have Flash!</a>
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' }); });
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.
eval
) is “external”, which breaks the workaround. If anyone knows of a /packer/-compatible solution, I'm all ears!.html()
, .prepend()
, etc.).prepend()