Share on Facebook

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.

Popularity: 3%

4 Responses to “Overcoming Flash Validation Issues”

Kjartan Ólason | August 25th, 2009 at 2:17 pm
commenter

I haven’t tested your code but:

$(’#flashdiv’).html(’>object type=”application/x-shockwave-

should be:

$(’#flashdiv’).html(’<object type=”application/x-shockwave-

??

commenter

Thanks for pointing out. We have corrected the typo.

commenter

very useful post thanks

commenter

Hello,
Thank you! I would now go on this blog every day!
Have a nice day

Leave a Reply:

Name (required):
Email Address (required, not published) :
Website :
Comment (required):