home *** CD-ROM | disk | FTP | other *** search
/ Thomson (Residential) / TGSTPv7203.iso / mac / Documentation / HTML / TG780-BUS_sv / wwhelp / wwhimpl / common / scripts / browseri.js < prev    next >
Text File  |  2007-06-22  |  3KB  |  119 lines

  1. // Copyright (c) 2000-2001 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. function  WWHBrowserInfo_Object()
  5. {
  6.   var  Agent;
  7.   var  MajorVersion = 0;
  8.  
  9.  
  10.   // Initialize values
  11.   //
  12.   this.mPlatform       = 0;      // Shorthand for Unknown
  13.   this.mBrowser        = 0;      // Shorthand for Unknown
  14.   this.mbWindowIE40    = false;  // Needed for special case handling
  15.   this.mbMacIE45       = false;  // Needed for special case handling
  16.   this.mbIEWindowsXP   = false;  // Needed for special case handling
  17.   this.mbUnescapeHREFs = true;   // Needed for special case handling
  18.   this.mbUnsupported   = false;
  19.  
  20.   // Get browser info
  21.   //
  22.   Agent = navigator.userAgent.toLowerCase();
  23.  
  24.   // Determine platform
  25.   //
  26.   if ((Agent.indexOf("win") != -1) ||
  27.       (Agent.indexOf("16bit") != -1))
  28.   {
  29.     this.mPlatform = 1;  // Shorthand for Windows
  30.   }
  31.   else if (Agent.indexOf("mac") != -1)
  32.   {
  33.     this.mPlatform = 2;  // Shorthand for Macintosh
  34.   }
  35.  
  36.   // Determine browser
  37.   //
  38.   if ((Agent.indexOf("mozilla") != -1) &&
  39.       (Agent.indexOf("spoofer") == -1) &&
  40.       (Agent.indexOf("compatible") == -1))
  41.   {
  42.     MajorVersion = parseInt(navigator.appVersion)
  43.  
  44.     if (MajorVersion >= 5)
  45.     {
  46.       this.mBrowser = 4;  // Shorthand for Netscape 6.0
  47.  
  48.       // Netscape 6.0 is unsupported
  49.       //
  50.       if (navigator.userAgent.indexOf("m18") != -1)
  51.       {
  52.         this.mbUnsupported = true;
  53.       }
  54.     }
  55.     else if (MajorVersion >= 4)
  56.     {
  57.       this.mBrowser = 1;  // Shorthand for Netscape
  58.     }
  59.   }
  60.   else if (Agent.indexOf("msie") != -1)
  61.   {
  62.     MajorVersion = parseInt(navigator.appVersion)
  63.     if (MajorVersion >= 4)
  64.     {
  65.       var  VersionString;
  66.  
  67.  
  68.       this.mBrowser = 2;  // Shorthand for IE
  69.  
  70.       // Additional info needed for popups
  71.       //
  72.       VersionString = navigator.appVersion.toLowerCase();
  73.       MSIEVersionString = VersionString.substring(VersionString.indexOf("msie") + 4);
  74.       Version = parseFloat(MSIEVersionString);
  75.       if ((Version >= 4.0) &&
  76.           (Version < 4.1))
  77.       {
  78.         if (this.mPlatform == 1)  // Shorthand for Windows
  79.         {
  80.           this.mbWindowsIE40 = true;
  81.         }
  82.       }
  83.       else if ((Version >= 4.5) &&
  84.                (Version < 4.6))
  85.       {
  86.         if (this.mPlatform == 2)  // Shorthand for Macintosh
  87.         {
  88.           this.mbMacIE45 = true;
  89.         }
  90.       }
  91.     }
  92.  
  93.     // See if we are running IE under Windows XP
  94.     //
  95.     if (Agent.indexOf("windows nt ") != -1)
  96.     {
  97.       if (parseFloat(Agent.substring(Agent.indexOf("windows nt ") + 11,Agent.length)) > 5)
  98.       {
  99.         this.mbIEWindowsXP = true;
  100.       }
  101.     }
  102.   }
  103.   else if (Agent.indexOf("icab") != -1)
  104.   {
  105.     this.mBrowser = 3;  // Shorthand for iCab
  106.   }
  107.  
  108.   // Set mbUnescapeHREFs boolean
  109.   //
  110.   if ((this.mBrowser == 2) &&  // Shorthand for IE
  111.       (this.mPlatform == 1))   // Shorthand for Windows
  112.   {
  113.     if (MajorVersion >= 5)
  114.     {
  115.       this.mbUnescapeHREFs = false;
  116.     }
  117.   }
  118. }
  119.