Forum Moderators: open
(these results look normal)
Netscape 4.75 :
You are using Netscape version 4.75 [en] (Windows NT 5.0; U)
(this is returning version 4.0 because i'm using the parseFloat command, right?)
MSIE 6.0 : You are using Microsoft Internet Explorer version 4.0 (compatible; MSIE 6.0; Windows NT 5.0)
(I could live with Mozilla being detected as netscape)
Mozilla 1.0 : You are using Netscape version 5.0 (Windows; en-US)
(what the heck is opera being detected as MSIE for?)
Opera 6.03 : You are using Microsoft Internet Explorer version 4.0 (compatible; MSIE 5.0; Windows 2000)
----------------
<script language="JavaScript">
<!-- Hide From Old Browsers
var browser_name = navigator.appName;
var browser_version = navigator.appVersion;
document.write ( "You are using " + browser_name + " version " + browser_version );
//-->
</script>
-----------------
So how can someone do a working browser detect based on the results of this? Any insight. I tried a forum search but the link was broken!
Thanks,
-OMP
Mozilla/3.0 (Windows 98; U) Opera 6.0 [en]
Mozilla/4.76 (Windows 98; U) Opera 6.0 [en]
Mozilla/5.0 (Windows 98; U) Opera 6.0 [en]
Mozilla/4.0 (compatible; MSIE 5.0; Windows 98) Opera 6.0 [en]
Opera/6.0 (Windows 98; U) [en]
So, you can search the string for "Opera".
I use something like this in php:
<?
$UA = getenv(HTTP_USER_AGENT);
if (strstr($UA,"Opera")) {
echo ("You're using Opera.");
}
?>
Of course this is server-side scripting.
All opera user-agent strings do contain the word 'Opera', so just search for that.
In Javascript,
this.ua = navigator.userAgent.toLowerCase();
this.opera = this.ua.indexOf('opera') != -1;
Recent versions also report true for "if(windows.opera)". This also
applies to Opera 5, so you'd have to check version number also.
news://news.opera.no/opera.tech/18933
There's also another way to do it. Check this:
window.opera
It is undocumented Opera's window property.
var opera = (window.opera ? true : false)
This will be true only in case of Opera browser.
good luck