JavaScript and Flash detection

M

Mika S.

Hi,

How can I detect if the Flash plugin is installed? Should be working
with the most common browsers and environments.

Thanks,
Mika
 
K

Klaus Johannes Rusch

Mika S. said:
How can I detect if the Flash plugin is installed? Should be working
with the most common browsers and environments.

A good piece of code is available at
http://www.dithered.com/javascript/flash_detect/index.html, works well
for all current browsers if you modify the call like this:

<script language="Javascript" type="text/javascript">
//<![CDATA[
function getFlashVersion() { return null; };
//]]>
</script>
<script language="Javascript" type="text/javascript"
src="flash_detect.js">
</script>
 
M

Mika S.

Anything else you try will have flaws. Even the above
has flaws. How do you use javascript to detect flash
is javascript is disabled?

Thanks for that, Randy. A very good point.

Mika
 
K

Klaus Johannes Rusch

HikksNotAtHome said:
<script type="text/javascript">
var flashEnabled = confirm('Click OK if you have Flash, click Cancel if you do
not have the Flash plugin');
if (flashEnabled)
{alert('Wow, you have Flash!')}
else
{alert('OOOps, No Flash installed')}
</script>

Anything else you try will have flaws. Even the above has flaws. How do you use
javascript to detect flash is javascript is disabled?

I suspect that Flash plugin detection will work more reliably than asking users
whether or not they have Flash installed ("Do I have what installed?") If
Javascript is not available falling back to the plain, non-Flash version is usually
a reasonable alternative.

<script type="text/javascript">
if (goodFlashVersion) {
document.write('<!-- put flash stuff here -->');
}
else {
document.write('<!-- put plain version here -->');
}
</script>
<noscript>
<!-- put plain version here -->
</noscript>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top