1 /** 2 * This snippet of code is required to generate the object tag 3 * only when the browser reports that the plugin is installed. 4 * 5 * @requires PluginDetect, BrowserDetect 6 */ 7 if (PluginDetect.detectGarminCommunicatorPlugin()) { 8 9 // Insert object tag based on browser 10 switch(BrowserDetect.browser) { 11 // TODO pull these out into constants later, in BrowserDetect 12 case "Explorer": 13 document.write('<object id="GarminActiveXControl" style="WIDTH: 0px; HEIGHT: 0px; visible: hidden" height="0" width="0" classid="CLSID:099B5A62-DE20-48C6-BF9E-290A9D1D8CB5"> </object>'); 14 break; 15 case "Safari": 16 // Outer div is necessary for Safari, and doesn't seem to affect other browsers. 17 // TODO try removing the divs to see if Safari 3+ has fixed their bug 18 document.write('<div style="height:0px; width:0px;">'); 19 document.write('<object id="GarminNetscapePlugin" type="application/vnd-garmin.mygarmin" width="0" height="0"> </object>'); 20 document.write('</div>'); 21 break; 22 case "OmniWeb": 23 case "Opera": 24 case "iCab": 25 case "Firefox": 26 case "Konqueror": 27 case "Camino": 28 case "Netscape": 29 case "Mozilla": 30 document.write('<object id="GarminNetscapePlugin" type="application/vnd-garmin.mygarmin" width="0" height="0"> </object>'); 31 break; 32 default: 33 document.write('<object id="GarminActiveXControl" style="WIDTH: 0px; HEIGHT: 0px; visible: hidden" height="0" width="0" classid="CLSID:099B5A62-DE20-48C6-BF9E-290A9D1D8CB5">'); 34 document.write(' <object id="GarminNetscapePlugin" type="application/vnd-garmin.mygarmin" width="0" height="0"> </object>'); 35 document.write('</object>'); 36 break; 37 } 38 39 } 40