Jump to content

SWFObject

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Wonderfl (talk | contribs) at 02:33, 14 April 2011 (removed the biased wording, much more neutral - flag it if still biased). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
SWFObject 2
Developer(s)Geoff Stearns with Toby Boudreaux and Bobby van der Sluis
Initial releaseJanuary 2006
Stable release
2.2 / June 12, 2009; 15 years ago (2009-06-12)
Repository
Written inJavaScript
PlatformWeb browser
Size10 KB (output JS file)
Available inEnglish
TypeJavaScript library
LicenseMIT License
Websitehttp://code.google.com/p/swfobject/

SWFObject (originally FlashObject[1]) is an open-source JavaScript library used to embed Adobe Flash content onto Web pages, which is supplied as one small JavaScript file.[2] The library can also detect the installed Adobe Flash Player plug-in in all major web browsers, on all major operating systems (OS), and can redirect the visitor to another webpage or show alternate HTML content if the installed plug-in is not suitable.[3]

The library is independent, although related external libraries often integrate with it, such as SWFAddress for deep linking and SWFFit for dynamic content scaling.

With the multitude of Flash embedding JavaScript libraries, SWFObject has emerged as the most popular being used by over 350,000 modern websites as of 2010[4], including high-profile websites such as Ask.com, Windows.com, Time.com, Skype.com, Discovery.com and YouTube.[5][6]

Usage

SWFObject provides a reliable method of embedding Flash content into a webpage[7] by internally handling the various practices that one must follow in order for different web browsers to display Flash content correctly, and isolating them from the web designer. The developer may interface with the library in a standardized manner, the minimum being a single line of JavaScript code.[8] Therefore even inexperienced web designers without knowledge of the ideal HTML code to embed Flash content, can easily insert Flash content into web pages, and have them reliably work for the widest possible audience (excepting those with JavaScript disabled).[citation needed] Flash content inserted using SWFObject will also work on devices that support JavaScript execution (and Flash Player), such as the Wii, PlayStation 3 and Nokia N800, unlike the PlayStation Portable.[9]

A major disadvantage with SWFObject is that visitors with JavaScript disabled in their web browsers will not be able to view the Flash content, and will instead see alternate HTML content provided by the web page. For websites that aim to reach the widest possible audience an alternate method is available, by using standards-compliant HTML markup to embed the Flash movie (typically using the <object> tags for the best browser compatibility[10]), and using the registerObject() function within the library's API[11] to register the Flash content enabling usage of the other features that the library provides.

Features

SWFObject also includes a few utility functions within its API to retrieve Flash Player related information, such as checking whether a specific version of Flash Player is installed,[12] and a few DHTML utilities to help work with the DOM.[13] Because of this, the most common reasons Flash Website developers turn to external JavaScript frameworks such as jQuery or Prototype are satisfied internally, giving developers fewer reasons to add additional JavaScript libraries to their website.

The library can also be used to integrate Flash Player Express Install into the webpage, allowing users to install the latest Flash Player without leaving the site, although this requires a browser restart.[14]

References

See also

SWFObject 1.5
SWFObject 2
General