var browserdetect = { Init:function () { This.browser = this.searchstring (this.databrowser) | | "An unknown browser"; This.version = This.searchversion (navigator.useragent) || This.searchversion (navigator.appversion) || "An unknown version"; This. OS = this.searchstring (This.dataos) | | "An unknown OS"; }, Searchstring:function (data) { for (Var i=0;i<data.length;i++) { var datastring = data[i].string; var dataprop = Data[i].prop; this.versionsearchstring = Data[i].versionsearch | | data[i].identity; if (datastring) { if (Datastring.indexof (data[i].substring)!=-1) return data[i].identity; } else if (Dataprop) return data[i].identity; } }, Searchversion:function (datastring) { var index = datastring.indexof (this.versionsearchstring); if (index = = 1) return; Return parsefloat (datastring.substring (index+this.versionsearchstring.length+1)); }, Databrowser: [ { String:navigator.userAgent, SubString: "Chrome", Identity: "Chrome" }, {string:navigator.userAgent, SubString: "OmniWeb", Versionsearch: "omniweb/", Identity: "OmniWeb" }, { String:navigator.vendor, SubString: "Apple", Identity: "Safari", Versionsearch: "Version" }, { Prop:window.opera, Identity: "Opera", Versionsearch: "Version" }, { String:navigator.vendor, SubString: "Icab", Identity: "Icab" }, { String:navigator.vendor, SubString: "KDE", Identity: "Konqueror" }, { String:navigator.userAgent, SubString: "Firefox", Identity: "Firefox" }, { String:navigator.vendor, SubString: "Camino", Identity: "Camino" }, {//For newer netscapes (6+) String:navigator.userAgent, SubString: "Netscape", Identity: "Netscape" }, { String:navigator.userAgent, SubString: "MSIE", Identity: "Explorer", Versionsearch: "MSIE" }, { String:navigator.userAgent, SubString: "Gecko", Identity: "Mozilla", Versionsearch: "rv" }, {//For older netscapes (from) String:navigator.userAgent, SubString: "Mozilla", Identity: "Netscape", Versionsearch: "Mozilla" } ], Dataos: [ { String:navigator.platform, SubString: "Win", Identity: "Windows" }, { String:navigator.platform, SubString: "Mac", Identity: "Mac" }, { String:navigator.userAgent, SubString: "IPhone", Identity: "Iphone/ipod" }, { String:navigator.platform, SubString: "Linux", Identity: "Linux" } ] }; Browserdetect.init (); |