Unobtrusive Flash Objects

The insertion of objects (especially Flash Objects) in web pages has recently become an often stressful. In other posts we have already addressed the topic of how to detect Flash and insert pages appropriately. As we talked about Unobtrusive techniques, we mark two well-known script can detect (and eventually install) and insert Flash objects on a page, in a very unobtrusive and afficiente: SWFObject and UFO .
Both scripts have essentially the same features and the same operation. The approach is to replace it with a particular tag using Javascript on your browser. As we know, this procedure eliminates the problem of activation of the Flash object imposed by Internet Explorer, however, implies that Javascript is enabled on the target browser.
Both scripts do not use any external libraries such as prototype.js for example. The most important difference between the two is that SWFObject is called when the TAG to be replaced is already loaded on the page, not exactly how Unobtrusive. Here is an excerpt of code that shows the call sequence:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
"flashcontent" > < div id = "flashcontent">
strong > < strong > You need to upgrade your Flash Player </ p >
This Is Replaced by the Flash content.
Place your alternate content here and users without the Flash plugin or with
Javascript turned off will see this. > noscript < / code > Content here allows you to leave out < code inline = "true"> noscript </ code >
tags. "swfobject.html?detectflash=false" > bypass the detection < / a > if you wish. Includes a link to < a href = "swfobject.html? detectflash = false"> bypass the detection </ a > if you wish.
</ div >
"text/javascript" > < script type = "text / javascript">
/ / <! [CDATA [
, "sotester" , "300" , "300" , "9" , "#FF6600" ) ; var so = new SWFObject ("so_tester.swf", "sotester", "300", "300", "9", "# FF6600");
) ; // this line is optional, but this example uses the variable and displays this text inside the flash movie so.addVariable ("flashVarText", "this is passed in via FlashVars for example only") / / this line is optional, but this example uses the variable and displays this text inside the flash movie
; so.write ("flashcontent");
/ /]]>
</ script >

UFOs , however, allows un'approccio much more in line with the classic Unobtrusive script. The replacement of the TAG is in transparent mode without loading abbligare sequences, as shown in the example below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
< head >
title > < title > Unobtrusive Flash Objects (UFO) | Sample Page </ title >
"Content-Type" content = "text/html; charset=iso-8859-1" / > < meta http-equiv = "Content-Type" content = "text / html; charset = iso-8859-1" />
"text/javascript" src = "ufo.js" >< / script > < script type = "text / javascript" src = "ufo.js"> </ script >
"text/javascript" > < script type = "text / javascript">
var FOR = {movie: "test8.swf", width: "300", height: "120", MajorVersion: "12", build: "0", xi: "true"};
UFO.create (FOR, "ufoDemo");
</ script >
</ head >
< body >
"ufoDemo" > < div id = "ufoDemo">
p > < p > Replacement content </ p >
"border: none;" / >< / a >< / p > Macromedia Flash Player "style =" border: none; "/> </ a > </ p >
</ div >
</ body >

In the source code of the script of UFOs , in fact, you can immediately use - more appropriate - an event that careful loading the page before you complete the replace operation; approach therefore extremely well suited to most scripts are not intrusive.

One Response to "Unobtrusive Flash Objects"

  1. November 11, 2007 undolog »Blog Archive» April 2008: farewell to the activation of the ActiveX for Flash :

    [...] In time, however, were introduced a series of shortcuts to avoid this annoying request official shortcuts (such as proposals by the same Macromedia Flash and Apple QuickTime) and unofficial (SWFObject or UFO, to example - see also Unobtrusive Flash Objects). According to Microsoft developers will not have to change anything in April 2008 in the "old" sites using shortcuts, but it is good to look at the blog of Internet Explorer for the special cases. [...]

Leave a comment

XHTML TAG PERMIT: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre> // blocco generico <code></code> // blocco generico [cc_actionscript][/cc_actionscript] // Actionscript [cc_actionscript3][/cc_actionscript3] // Actionscript 3 [cc_css][/cc_css] // CSS Style Sheet [cc_html][/cc_html] // HTML [cc_js][/cc_js] // Javascript [cc_objc][/cc_objc] // Objective-C [cc_php][/cc_objc] // PHP [cc_sql][/cc_sql] // SQL