Overcoming Flash Validation Issues

Flash embedding that is compliant with the web standards has always been an issue as the code runs very long and it is very difficult to place Flash reliably.

So, how to overcome validation issues of Flash object on a web page?

Use jQuery's document ready function (JavaScript which is triggered when the DOM is loaded).

Have a look at the below code:

jQuery Part

$(document).ready(function(){

if ($.browser.msie) {


$('#flashdiv').html('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ width="468″ height="60″><param name="movie" value="yourflashfile.swf" /><param name="wmode" value="transparent"/></object>');

} else {

$('#flashdiv').html('>object type="application/x-shockwave-flash" data="yourflashfile.swf" wmode="transparent" width="468″ height="60″></object>');
}
});

Note: Please use the above code in a separate .js file and just call it in the webpage.

HTML Part

<body>
<div id="flashdiv"></div>
</body>

The 'if' statement detects the browser used and uses the best method of flash embedding to compliment that particular browser. The $('#flashdiv').html(); takes the element with the ID of flashdiv and injects into it the content. This helps to place the code we want to load into the div. This technique is extremely SEO friendly as there will be only empty div when scanned by the search engine spiders and also there will not be any validation issues.

Comments