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=="Microsoft Internet Explorer". To always correctly return "opera" I modified the code slightly. Now it checks if navigator.appName=="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.
*/
function Browser() {
    var b=navigator.appName;
    if (b=="Netscape") this.b="ns";
    // added appName check and removed the "else" from the opera check
    if ((b=="Opera") || (navigator.userAgent.indexOf("Opera")>0)) this.b = "opera";
    else if (b=="Microsoft Internet Explorer") this.b="ie";
    if (!b) alert('Unidentified browser./nThis browser is not supported,');
    this.version=navigator.appVersion;
    this.v=parseInt(this.version);
    this.ns=(this.b=="ns" && this.v>=4);
    this.ns4=(this.b=="ns" && this.v==4);
    this.ns5=(this.b=="ns" && this.v==5);
    this.ie=(this.b=="ie" && this.v>=4);
    this.ie4=(this.version.indexOf('MSIE 4')>0);
    this.ie5=(this.version.indexOf('MSIE 5')>0);
    this.ie55=(this.version.indexOf('MSIE 5.5')>0);
    this.opera=(this.b=="opera");
    this.dom=((document.createRange&&(document.createRange().createContextualFragment))?true:false);
    var ua=navigator.userAgent.toLowerCase();
    if (ua.indexOf("win")>-1) this.platform="win32";
    else if (ua.indexOf("mac")>-1) this.platform="mac";
    else this.platform="other";
}
is = DynAPI.browser = new Browser();
--- END OF SOURCE
 
 
----- Daniel Holmen
-- ECsoft Norway

Reply via email to