-1

I have both a HTML5 animation (created by swiffy) and my FLASH animation. I'm looking for a simple script that will detect HTML5 compatibility and if not compatible the FLASH animation will be used in it's place. Everything I read talks about controls, talks about it as the entire page etc. It's section in my HTML page. I posted an image of it to show how it's used in the HTML. The red box is the animation. Thanks!

enter image description here

jennyooooo
  • 95
  • 1
  • 2
  • 9
  • What HTML5 tags are you using to animate stuff? `canvas`? – putvande Nov 21 '13 at 21:52
  • possible duplicate of [Best way to detect that HTML5 is not supported](http://stackoverflow.com/questions/2745432/best-way-to-detect-that-html5-canvas-is-not-supported) – putvande Nov 21 '13 at 21:53
  • It doesn't use This is the code Swiffy kicks out: – jennyooooo Nov 21 '13 at 21:59
  • Well just check the `possible duplicate` I put in the comment above. That will help you. – putvande Nov 21 '13 at 22:02

2 Answers2

1

and thanks for telling me what animation tool you're using.
I looked into Swiffy's HTML, and it uses SVG, so here's the finished script, I think:

function getAnimation()
{
    if(document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Shape", "1.0"))
    {
        return "SVG";
    }
    else
    {
        return "Flash";
    }
}

Just use that, or the if statement, rather, to detect whether the browser supports SVG and therefore supports Swiffy.

Atutouato
  • 375
  • 4
  • 13
0

Use SWFObject to embed the Flash in the page and you can take advantage of the dynamic publishing feature which will replace your alternative content (the Swiffy animation) if Flash is not supported (see demo here).

It's the inverse of the way you're proposing handling fallback, but the Flash animation is almost certainly going to perform better so should probably be the default for devices which support Flash, with the Swiffy fallback pushed out only to devices which don't.

net.uk.sweet
  • 12,444
  • 2
  • 24
  • 42