View Full Version : browser detection script help please

09-09-2001, 12:04 PM
My website contains dynamic elements that are only supported by MSIE 4+, NS 4+ and Opera 5+
i have a script that will detect for msie and ns but i dont know how to add OPera 5+ could someone please help. This is the script i have so far:


var browser=''; // Variable to store Browser name
var version=''; // Variable to store Browser version
var entrance=''; //Variable to store result
var oktext=''; // Variable to store ok-text
var notok=''; // Variable to store NtoOk-text
// Check Browser name
if (navigator.appName.indexOf('Microsoft') != -1)
browser = 'IE'
else if (navigator.appName.indexOf('Netscape') != -1)
browser = 'Netscape'
else browser = 'NN';
// Browser Version
if (version == ''){
version= navigator.appVersion;
paren = version.indexOf('(');
whole_version = navigator.appVersion.substring(0,paren-1);
version = parseInt(whole_version);
if (browser=="Netscape" && version>= "4.00")entrance="ok"
if (browser=="IE" && version>= "4.00")entrance="ok"
if (entrance=="ok"){
if (entrance!="ok"){
// STOP HIDE -->

Thanks in advance