View Full Version : plug in detection and netscape

10-10-2003, 01:18 PM
Hello, I´m using this code to detect plug ins and install them, but when trying it on netscape, it does not work. What should I do? how can I make alert, or window.confirm work on netscape?

var agt=navigator.userAgent.toLowerCase();
var ie = (agt.indexOf("msie") != -1);
var ns = (navigator.appName.indexOf("Netscape") != -1);
var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
var mac = (agt.indexOf("mac")!=-1);

if (ie && win) { pluginlist = detectIE("Adobe.SVGCtl","SVG Viewer")
+ detectIE("SWCtl.SWCtl.1","Shockwave Director")
+ detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash")
+ detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer")
+ detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime")
+ detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player")
+ detectIE("PDF.PdfCtrl.5","Acrobat Reader")
+ detectIE("ADView.Adviewer.1","Autodesk Express Viewer Control"); }

if (ns || !win) {
nse = ""; for (var i=0;i<navigator.mimeTypes.length;i++) nse += navigator.mimeTypes[i].type.toLowerCase();
pluginlist = detectNS("image/svg-xml","SVG Viewer")
+ detectNS("application/x-director","Shockwave Director")
+ detectNS("application/x-shockwave-flash","Shockwave Flash")
+ detectNS("audio/x-pn-realaudio-plugin","RealPlayer") + detectNS("video/quicktime","QuickTime")
+ detectNS("application/x-mplayer2","Windows Media Player") + detectNS("application/pdf","Acrobat Reader")
+ detectcNS("application/dwf","Autodesk Express Viewer");

function detectIE(ClassID,name) { result = false; document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))</SCRIPT>\n'); if (result) return name+','; else return ''; }
function detectNS(ClassID,name) { n = ""; if (nse.indexOf(ClassID) != -1) if (navigator.mimeTypes[ClassID].enabledPlugin != null) n = name+","; return n; }

pluginlist += navigator.javaEnabled() ? "Java," : "";
if (pluginlist.length > 0) pluginlist = pluginlist.substring(0,pluginlist.length-1);

function fullwin(targeturl){


function displayWindowInfo() {
alert("plug in Flash instalado");

if (pluginlist.indexOf("Acrobat Reader")!=-1){
alert("Comprobación de plug-in Acrobar Reader correcta.")
window.confirm("Para la correcta visualizacion de algunas partes del cd, es necesario que instale en su equipo la siguiente aplicación: AcroReader51_ESP.exe")
if (pluginlist.indexOf("Windows Media Player")!=-1){
alert("Comprobación de plug-in Windows Media Player correcta.")
window.confirm("Para la correcta visualizacion de algunas partes del cd, es necesario que instale en su equipo la siguiente aplicación: MPSetup.exe")
if (pluginlist.indexOf("Shockwave Flash")!=-1){
alert("Comprobación de plug-in Shockwave Flash correcta.")
window.confirm("Para la correcta visualizacion de algunas partes del cd, es necesario que instale en su equipo la siguiente aplicación: Install Flash Player 6.exe")
open("controles/Install Flash Player 6.exe")
if (pluginlist.indexOf("Autodesk Express Viewer")!=-1){
alert("Comprobación de plug-in Autodesk Express Viewer correcta.")
window.confirm("Para la correcta visualizacion de algunas partes del cd, es necesario que instale en su equipo la siguiente aplicación: ExpressViewerSetup.exe")
if((pluginlist.indexOf("Acrobat Reader")!=-1)&&(pluginlist.indexOf("Windows Media Player")!=-1)&&(pluginlist.indexOf("Shockwave Flash")!=-1)&&(pluginlist.indexOf("Autodesk Express Viewer")!=-1)){
window.close('detector de plugins.htm')
fullwin ('presentacion.htm','scroll:no')
window.open("detector de plugins.htm","self")


Roy Sinclair
10-10-2003, 02:45 PM
Go back to the source where you got this script and get the REST of the script. You're missing the detectNS function. Also correct the typo where you mis-spelled it for the AutoDesk Express plugin.

10-13-2003, 09:41 AM
and how do I detect netscape?

Roy Sinclair
10-13-2003, 07:20 PM
Originally posted by medi78
and how do I detect netscape?

Which version(s) of Netscape? There were two entirely different browsers that have been called Netscape and both have been discontinued (though the latter one is still being developed under the Mozilla name and is pretty much the best browser out there IMO).

Beyond that, here's a huge list of ways to do what you want:


10-14-2003, 01:29 AM
Of course I´ve been searching (do u really think I have not?), no knowledge comes automatically, but I still do need some help, I´m not such a good programmer yet. The version I referred was from 4x to above. I´d like my applications to be the most compatible with the highest number of computers. If u want to help me, I´ll thank you. If u do not, don´t waste your time. Have a nice day there in Wichita. Here in San Sebastian it´s raining.

The monkey speaks his mind.

10-14-2003, 01:35 AM
ah, one more thing, I didn´t know that mozilla and netscape worked in similar ways. I knew javascript was developed by netscape, but I actually don´t understand why coding for IE is much easier.... microsoft ate the world wide marketing.

Roy Sinclair
10-14-2003, 03:30 PM
Coding for IE is a lot easier because MS created a lot of shortcuts to objects that you don't find in Netscape. While those shortcuts made programming only for IE easier since Netscape never adopted them they've muddied the waters and made cross browser coding more difficult because those shortcuts cause people to think that Netscape is broken when the truth is they're using an IE only construct.

Netscape version 4 is the last browser written by Netscape. When Netscape 6 was released it was really just a beta version of the Mozilla browser packed with all the other garbage that Netscape had always packed around the Netscape 4 browser. There is no more Netscape browser (no new releases) these days but the Mozilla project still produces the Mozilla browser and it's still a most exellent browser.

It would really help if you could say where you got this code from in the first place. The problem is that you didn't get all of the code and while we could eventually figure out what that missing code might be there shouldn't be a need to do that if the code is still available somewhere else.

10-15-2003, 01:48 PM
Hello. I took the code from:


As you can see I almost did cut and paste. Maybe I should work harder and try to detect NS myself.

10-15-2003, 01:49 PM
I thougt the var 'ns' was enough to work itself.