Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-11-20
5
Medium Priority
?
79 Views
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
</div>

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

You quick reply is deeply appreciated.
0
Comment
Question by:davidgm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40456138
0
 

Author Comment

by:davidgm
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?
0
 
LVL 58

Expert Comment

by:Gary
ID: 40456309
Grab the library here and add to your page
http://code.google.com/p/swfobject/downloads/list

Under Dynamic Publishing
http://learnswfobject.com/the-basics/

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

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

Open in new window

0
 

Author Comment

by:davidgm
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.
0
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 40457978
<script>
var version = swfobject.getFlashPlayerVersion();

if(version.major>0){
// has flash
}
else{
// no flash
}
</script>

Open in new window

0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

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.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

721 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