Because most sites on the net check for IE or Netscape browsers Opera =
has had to pretend to be one of these for the sites to display. This is =
USER definable, and the check in browser.js only checks for Opera if =
navigator.appName=3D=3D"Microsoft Internet Explorer". To always =
correctly return "opera" I modified the code slightly. Now it checks if =
navigator.appName=3D=3D"Opera" or if Opera identifies as ANY other =
browser. This is only a minor correction to your existing source:
--- SOURCE: Browser.js
/*
DynAPI Distribution
Browser Class
The DynAPI Distribution is distributed under the terms of the GNU =
LGPL license.
*/=20
function Browser() {
var b=3Dnavigator.appName;
if (b=3D=3D"Netscape") this.b=3D"ns";
// added appName check and removed the "else" from the opera check
if ((b=3D=3D"Opera") || (navigator.userAgent.indexOf("Opera")>0)) =
this.b =3D "opera";
else if (b=3D=3D"Microsoft Internet Explorer") this.b=3D"ie";
if (!b) alert('Unidentified browser./nThis browser is not =
supported,');
this.version=3Dnavigator.appVersion;
this.v=3DparseInt(this.version);
this.ns=3D(this.b=3D=3D"ns" && this.v>=3D4);
this.ns4=3D(this.b=3D=3D"ns" && this.v=3D=3D4);
this.ns5=3D(this.b=3D=3D"ns" && this.v=3D=3D5);
this.ie=3D(this.b=3D=3D"ie" && this.v>=3D4);
this.ie4=3D(this.version.indexOf('MSIE 4')>0);
this.ie5=3D(this.version.indexOf('MSIE 5')>0);
this.ie55=3D(this.version.indexOf('MSIE 5.5')>0);
this.opera=3D(this.b=3D=3D"opera");
=
this.dom=3D((document.createRange&&(document.createRange().createContextu=
alFragment))?true:false);
var ua=3Dnavigator.userAgent.toLowerCase();
if (ua.indexOf("win")>-1) this.platform=3D"win32";
else if (ua.indexOf("mac")>-1) this.platform=3D"mac";
else this.platform=3D"other";
}
is =3D DynAPI.browser =3D new Browser();
--- END OF SOURCE
----- Daniel Holmen
-- ECsoft Norway
|