View Full Version : Identifying Opera...
Vladdy
11-07-2002, 02:10 AM
When dealing with Opera the navigator.appName is unreliable since the damn thing has a disguise option "Identify as..." :rolleyes:
Apparently Opera does not support for...in statment so I figured the following fragment would identify the pretender:
navSummary='';
for(i in navigator) navSummary+=i + ': ' + navigator[i] + '<br />';
if(navSummary.length == 0)
browser = 'pretender';
Would like to hear about other ways...
glenngv
11-07-2002, 02:27 AM
but even if it can disguise as IE, it still has the word Opera in its user agent:
Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.01 [en]
boywonder
11-07-2002, 03:12 AM
Far as I know ( and as Glenn pointed out ) you can always flag an Opera browser simply by finding "Opera" in the UA string.
realisis
11-07-2002, 03:51 AM
Hi Vladdy,
<splittinghairs>Opera refuses to enumerate almost all Obj, Props, Meths, etc, but it does support the for...in loop:
for (eachProp in window.RegExp) etc...
prints out the nine $...
Vladdy
11-07-2002, 04:02 AM
thanks, all.
:o should have thought about .userAgent myself :o
This might be usefull
http://www.opera.com/docs/specs/js/
I tend to use
if(window.opera)
{
//do opera stuff
}
as only Opera should have the window.opera attribute.
glenngv
11-07-2002, 06:47 AM
Originally posted by RoyW
I tend to use
if(window.opera)
{
//do opera stuff
}
as only Opera should have the window.opera attribute.
but that is not safe if you have a variable named opera, which of course you wouldn't do, but who knows one way or another, one site would use it :D
var opera = "Metropolitan Opera";
if(window.opera)
{
//do opera stuff
}
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.