VRML-plugin detector
for handgestrickts AJAX-VRML-project we needed a good VRML detector. we found a spaghetti-code at Robert Lipmans website, which is by the way a good place to go if you want to know nearly everything about VRML and X3D. after we rewrote the code a little bit to fit our needs we tested it on several platforms and it works. here is it:
<!--[if IE]>
<script language="VBScript" type="text/vbscript">
function IEDetectObject(activeXControlName)
On Error Resume Next
IEDetectObject = IsObject(CreateObject(activeXControlName))
End function
</script>
<![endif]-->
<script language="JavaScript" type="text/javascript">
funtion VRMLsupport() {
if(document.all && !window.opera) {
var plugins = [
'Cortona.Control.1', //Cortona
'blaxxunCC3D.blaxxunCC3D.1', //blaxxun Contact
'bsContact.bsContact.1', //BS Contact
'SGI.CosmoPlayer.1', //Cosmo Player
'SGI.CosmoPlayer.2',
'ANIMA.AnimaCtrl.1', //Flux Player
'OCTAGAX.OctagaXCtrl.1', //Octaga Player
'OctagaProX.OctagaProX.1', //Octaga Pro
'VenuesCtrl.VenuesCtrl.1', //Venues Viewer
'Nexternet.NexternetPlayer.1', //Pivoron Player
'Owatl.OwCtl.1', //OpenWorlds
'WorldView.WorldView VrmlViewer.1', //WorldView
'WorldView.WorldView VrmlViewer.2',
'WORLDVIEW.WorldViewCtrl.1'
];
for(var a=0;a<plugins.length;a++) {
if(IEDetectObject(plugins[a])) return true;
};
} else if(typeof(navigator.mimeTypes) == 'object') {
for(var a=0;a<navigator.mimeTypes.length;a++) {
if(navigator.mimeTypes[a].suffixes.search(/^wrl$|^wrl,|,wrl$/i) != -1) return true;
};
};
return false;
}
</script>
the usage is rather easy:
boolean VRMLsupport()
example:
var support = VRMLsupport(); //support should be true or false

