Redirecting to another page when Flash is not installed

For all you that need to redirect users to another page if they don’t have Flash installed and use swfobject, just drop this code and you’re good to go:

var playerVersion = swfobject.getFlashPlayerVersion(); // returns a JavaScript object
var majorVersion = playerVersion.major; // access the major, minor and release version numbers via their respective properties

if (majorVersion == 0)
{
 document.location = '/PAGE_THE_USER_SHOULD_BE_REDIRECTED_TO';
}

This should go just before:

swfobject.embedSWF("xmas/happy_christimas_2009.swf", "flashcontent", "100%", "100%", "10", false, flashvars, params, attributes);

Let me know if you have a different approach.

I have found this (http://pastie.org/433193 ) while searching for a solution to my problem, but it made more sense to rely on swfobject API since I was already using it to embed flash.

Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • IGlr