Detecting plug-ins

Q

Qiang Lin

Hi,

I am running a script to find out the plug-ins installed in my pc. I run the
same script both in IE 6.0 and Netcape 7.1, but I got different results. IE
says "JavaScript couldn't find any plugins", and Netcape returns a table
listing all plug-ins. Can anyone tell me why this happens? Thanks!

---------------------------the script-----------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>What are my plugins?</title>
</head>
<body bgcolor="#FFFFFF">
<script language="Javascript" type="text/javascript">
<!-- Hide script from older browsers

if (navigator.plugins && navigator.plugins.length > 0) {
document.write("You have the following plugins: <table cellspacing='4'
cellpadding='4'>")
document.write("<tr><th bgcolor='#CCCCCC'>Name<\/th><th
bgcolor='#CCCCCC'>Filename<\/th><th
bgcolor='#CCCCCC'>Description<\/th><\/tr>")

for (i=0; i<navigator.plugins.length; i++) {
thisPlugin = navigator.plugins
document.write("<tr valign='top'><td bgcolor='#CCCCCC'>" +
thisPlugin.name)
document.write("<\/td><td bgcolor='#CCCCCC'>" + thisPlugin.filename)
document.write("<\/td><td bgcolor='#CCCCCC'>" + thisPlugin.description +
"<\/td><\/tr>")
}
document.write("<\/table>")
}
else {
document.write("JavaScript couldn't find any plugins")
}

// End hiding script from older browsers -->
</script>
</body>
</html>
------------------------------------------
 
K

kaeli

[email protected] enlightened said:
Hi,

I am running a script to find out the plug-ins installed in my pc. I run the
same script both in IE 6.0 and Netcape 7.1, but I got different results. IE
says "JavaScript couldn't find any plugins", and Netcape returns a table
listing all plug-ins. Can anyone tell me why this happens? Thanks!


if (navigator.plugins && navigator.plugins.length > 0)

Only netscape has navigator.plugins, so yeah, IE wouldn't find anything.
There is no navigator object in IE.

See:
http://www.rgagnon.com/jsdetails/js-0056.html

--
--
~kaeli~
Found God? If nobody claims Him in 30 days, He's yours to
keep.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 

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,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top