Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Flash to HTML5

DZone's Guide to

Flash to HTML5

· Web Dev Zone
Free Resource

Learn how to build modern digital experience apps with Crafter CMS. Download this eBook now. Brought to you in partnership with Crafter Software

 

One of the biggest challenges in last 2-3 years has been showing flash animations on devices like IPAD which do not support flash. One alternative is to convert the Flash animation into an HTML5 animation. One of the tools available for this is Google Swiffy. This is one of the best tools available right now. It does a pretty good job of basic flash animations but any flash with advanced action scripting will not be converted correctly.

Once you have HTML5 animation ready, you will need to do some sniffing and display the HTML5 code instead of the swf file,  for devices like IPAD. We present two alternatives for this.

Check if device is IPAD and show HTML5. Sample PHP code is as below.

if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),’ipad’) > 0) {

TRUE implies device is IPAD. Hence show HTML5 animation

Check if there is flash support on the device. If no support, then show HTML5. This approach will show HTML5 animation on any browser which has flash disabled or which does not have flash support. Sample code is as below.

Download the flash detection java script file from http://www.featureblend.com/javascript-flash-detection-library.html

Include the js file “flashDetect.js”
Add the following code to detect flash

<script type=”text/javascript”>
if(!FlashDetect.installed) {

//Add code here

}
</script>

A similar exercise can be done to show videos via HTML5 as HTML5 has native support for videos via the video tag.

Crafter is a modern CMS platform for building modern websites and content-rich digital experiences. Download this eBook now. Brought to you in partnership with Crafter Software.

Topics:

Published at DZone with permission of Sapna Group, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}