detecting plugins (small code sample inc)
I am trying to detect what plugins a browser as : The following code works fine in Naviagator and "should" work fine in explorer - does anyone have an idea why not and what I can do to fix the prob'
<HTML>
<HEAD>
<TITLE>Got Flash?</TITLE>
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!-- Hide script from older browsers
hasFlash = false
for (i=0; i<navigator.plugins.length; i++) { alert("plugin")
if (navigator.plugins[i].name.indexOf("Shockwave") >= 0) {
hasFlash = true
}
}
// End hiding script from older browsers -->
</SCRIPT>
</HEAD>
<BODY BGCOLOR=WHITE>
<H2>
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!-- Hide script from older browsers
if (hasFlash) {
document.write("You have Flash, you lucky person, you!")
}
else {
document.write("Sorry, you don't have Flash.")
}
// End hiding script from older browsers -->
</SCRIPT>
</H2>
</BODY>
</HTML>
------------------
John Pollock posted this at 03:54 — 10th December 1999.
He has: 628 posts
Joined: Mar 1999
I don't see a problem at first glance. Is it giving you an error message? That might help us figure out where it is going wrong in IE.
JP Stones posted this at 05:03 — 10th December 1999.
They have: 2,390 posts
Joined: Nov 1998
There is a good Flash detection script being used at dittybase.com you might want to look at...
JP
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.