![]() | |
Developer(s) | Geoff Stearns withBobby van der Sluis,Aran Rhee,Kyle Simpson andPhilip Hutchison |
---|---|
Initial release | January 2006 |
Final release | 2.2 / June 12, 2009; 15 years ago (2009-06-12) |
Repository | |
Written in | JavaScript |
Platform | Web browser |
Size | 10 KB (outputJS file) |
Available in | English |
Type | JavaScript library |
License | MIT License |
Website | https://github.com/swfobject/swfobject |
SWFObject (originallyFlashObject) is an unmaintainedopen-sourceJavaScriptlibrary used to embedAdobe Flash content ontoWeb pages and to protect theflash game against piracy,[1] which is supplied as one small JavaScript file.[2][3] The library can also detect the installedAdobe Flash Playerplug-in in all majorweb browsers, on all majoroperating systems (OS), and can redirect the visitor to another webpage or show alternateHTML content if the installed plug-in is not suitable.[4]
The library is independent, although related external libraries often integrate with it, such as SWFAddress fordeep linking andSWFFit for dynamic content scaling.
With the multitude of Flash embedding JavaScript libraries, SWFObject has emerged as the most popular being used by over 2,600,000 websites as of 2011,[5] including high-profile websites such asAsk.com,Windows.com,Time.com,Skype.com,Discovery.com andYouTube.[6]
SWFObject provides a reliable method of embedding Flash content into a webpage[7][8] 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 theweb designer. The developer may interface with the library in a standardized manner, the minimum being a single line of JavaScript code.[9] 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).[10] Flash content inserted using SWFObject will also work on devices that supportJavaScript execution (andFlash Player), such as theWii,PlayStation 3 andNokia N800, unlike thePlayStation Portable.[11]
A disadvantage with SWFObject is that visitors with JavaScript disabled in their web browsers will not be able to view the Flash content,[12] and will instead see alternate HTML content provided by the web page.[13] 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[14]), and using the registerObject() function within the library's API[15] to register the Flash content enabling usage of the other features that the library provides.
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,[16][17] and a fewDHTML utilities to help work with theDOM.[18] Because of this, the most common reasons Flash Website developers turn to externalJavaScript frameworks such asjQuery orPrototype are satisfied internally, giving developers fewer reasons to add additional JavaScript libraries to their website.
The library can also be used to integrate Flash PlayerExpress Install into the webpage, allowing users to install the latest Flash Player without leaving the site, although this requires a browser restart.[19]
SWFAddress is a JavaScript and ActionScript library that allows Flash websites to supportdeep linking, and can automatically integrate with SWFObject.
SWFFit (formerly known asFitFlash) is aJavaScript library used to resize Flash movies according to thebrowser window size, keeping it accessible independent of the screen resolution.[20][21][22][23] SWFFit primarily configures the web browser to display scroll bars when content exceeds the browser window size. It can also be used to dynamically resize the Flash movie size. It is used together with SWFObject.