Tuesday, September 12, 2006

SWFObject: Javascript Flash Player detection and embed script

SWFObject is a small Javascript file used for embedding Macromedia Flash content. The script can detect the Flash plug-in in all major web browsers (on Mac and PC) and is designed to make embedding Flash movies as easy as possible. It is also very search engine friendly, degrades gracefully, can be used in valid HTML and XHTML 1.0 documents*, and is forward compatible, so it should work for years to come.

Using SWFObject is easy. Simply include the swfobject.js Javascript file, then use a small amount of Javascript on your page to embed your Flash movie. Here is an example showing the minimum amount of code needed to embed a Flash movie:

<script type="text/javascript" src="swfobject.js"></script>

<div id="flashcontent">
This text is replaced by the Flash movie.
</div>

<script type="text/javascript">
var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7", "#336699");
so.write("flashcontent");
</script>

Read more here
* Pages sent as text/html, not application/xhtml+xml.

Monday, September 11, 2006

Startup Review Blog

Nisan Gabbay's Startup Review blog - interesting read!

Wednesday, September 06, 2006

The Decorator Pattern for JavaScript

beppu has written about the Decorator Pattern for Javascript.

He has provided a very very useful piece of code using which every object can now have a before() and after() method that would work like this -

before(‘method’, function() { });
after(‘method’, function() { });

This will provide us more flexibility in playing with objects and definitely reduce the code a little :)

Read more here.