SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist artcoder's Avatar
    Join Date
    Aug 2005
    Location
    Planet Earth
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to detect if device has Flash

    I'm using Flash on a webpage. But iPad and iPhone devices can not display Flash and shows blank area. How can I detect if a device visiting my page has Flash or not? If it supports Flash, I want to display Flash. If not, I want to display a static image.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,869
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Wrap the flash object tag around the img tag. That way if the object cannot be processed the image it wraps will display instead.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    In addition to what Felgall said, you can also use a JavaScript library like SWFObject to embed the flash.

    It will detect whether you have Flash available or not and inject the correct <object> tag for you.

    Of course, then you're creating a reliance on JavaScript :P

    The SWObject Documentation page has examples for both techniques.
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,869
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    I would recommend using the SWObject JavaScript just to detect the Flash version so as to strip out the object tag if the version of Flash available is too old. That way you still have a good chance of having the Flash work even where JavaScript is disabled.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    SWFObject also comes with an "ExpressInstall" SWF, if you for example specify that your flash requires version 9 and the user has version 8, the ExpressInstall will kick in and ask them to upgrade.

    (Though this path obviously will not work if the user chooses not to upgrade, in which case felgall's solution would be the way to go)
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •