This is a message.

Handling old flash versions

You can supply the required Flash version in the second argument for flashembed like this:

flashembed("clock", {
src: "/media/swf/global/clock.swf",
version: [20, 0]
});

JavaScript

This time, the second argument is not just a string, it's an object with two properties: src and version. The latter property specifies the required version that is required. We used a very large number so that you can see what happens without any additional setup.

standalone demo

The Default behavior

The default behaviour is to write the following HTML snippet to the container if the user does not have the required version:

  <div id="clock">
<h2>Flash version 20,0 or greater is required</h2>
<h3>Your version is 9,31</h3>
<p>
Download the latest version from
<a href="http://www.adobe.com/go/getflashplayer">here</a>
</p>
</div>

HTML

You can also style this content any way you want with CSS.

Default content in the container

If you are not happy with the default error message, you can supply your own error message simply by placing some HTML inside the container. Here is one example message:

Get Adobe Flash Player

You must have the latest Flash player installed. You can download it here.


standalone demo

And here is the corresponding HTML code:

<!-- here is the container with the default error message inside it -->
<div id="fail2">
<img src="/media/img/flashplayer_100x100.jpg" />
<h3>Get Adobe Flash Player</h3>
 
<p>
You must have the latest Flash player installed. You
can <a href="http://get.adobe.com/flashplayer/">download it
here</a>.
</p>
 
<br clear="all" />
</div>
 
<!-- place flash in our container and require version 20 and above -->
<script>
flashembed("fail2", {src: "/media/swf/global/clock.swf", version: [20, 0]});
</script>

HTML

Express Install and the custom onFail function

Here we are using Adobe's Express Install when an old Flash version is detected. Express Install is an option for seamlessly upgrading visitors to your website to the latest player using a Flash-based experience. Express Install allows you to design an in-context upgrade experience for your content so users never have to leave your site. It also lets you gracefully handle user cancellation and avoid system restarts.

We also use the onFail callback function here where you can do your own custom logic with JavaScript when an old version is detected. Here we write some information below the Express Install SWF file:

standalone demo

JavaScript coding

Here is how the above example was configured:

flashembed("fail3", {
src: "/media/swf/global/clock.swf",
 
// provide large enough version number so we can see what happens
version: [20, 0],
 
// supply your path to the express install Flash object.
expressInstall: "/media/swf/global/expressinstall.swf",
 
// called every time the supported version is not found
onFail: function() {
document.getElementById("info").innerHTML
= "You need version 20.0 to view this content";
}
});

JavaScript