Detect whether Flash is supported and display the appropriate <div>

Posted on 2014-11-20
Last Modified: 2014-12-05
I need to detect whether a browser supports Flash and then display the appropriate div within a web page. The div will just contain an image link. For example:

Detect whether flash is supported

if supported:
<div id="flash">
a link to flash content web page

if not supported:
<div id="Other">
a link to non flash content page (pdf)

You quick reply is deeply appreciated.
Question by:davidgm
  • 3
  • 2
LVL 58

Expert Comment

ID: 40456138

Author Comment

ID: 40456274
My intention was to display an image link that directs to the Flash page and not embed the Flash movie in the div itself, I can't seem to see how to do this with swfobject?
LVL 58

Expert Comment

ID: 40456309
Grab the library here and add to your page

Under Dynamic Publishing

Code sample taken from the link above
<script type="text/javascript">
swfobject.embedSWF("mymovie.swf", "flashcontent", "550px", "400px", "9");

<div id="flashcontent">
      Fallback or 'alternate' content goes here.
      This content will be replaced by the SWF
      after SWFObject embeds it.

Open in new window


Author Comment

ID: 40457465
OK, I did this. It works for the non Flash content. That is, it displays a link button that users can click on to view a pdf document. However, it does not work for the Flash content. Yes, it embeds the flash in the div (a small div located on an html page with lots of other content in it) but that is not what I need. If Flash is supported, I just need to put a - button link - that, when clicked on, takes to a separate html page that has the Flash file embedded in.
LVL 58

Accepted Solution

Gary earned 500 total points
ID: 40457978
var version = swfobject.getFlashPlayerVersion();

// has flash
// no flash

Open in new window


Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now