A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; Waterfall_Cache has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 47

A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; Cache_System has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 194

A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; Memcache_Cache_System has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 275

A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; Filesystem_Cache_System has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 440

A PHP Error was encountered

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; APC_Cache_System has a deprecated constructor

Filename: _common/waterfall_cache.php

Line Number: 628

Netscape 6, Part I: Detection and Scripting Page 2

Netscape 6, Part I: Detection and Scripting Page 2

By Yehuda Shiran (Send Email)
Posted Dec 5, 2000


Layout engine with content model
  • Style system (handles CSS, etc.)
  • JavaScript runtime
  • Image rendering library
  • Networking library "Necko"
  • Platform-specific graphics rendering and widget sets for Win32, X, and Mac
  • User preferences library
  • Mozilla Plug-in API to support the Navigator plug-in interface
  • Open Java Interface (OJI), with Sun Java 1.2 JVM
  • RDF hypertree back end
  • Font library
  • Security library
  • Cache management system

    Browser Detection

    The most common pattern in your JavaScript scripts is probably the section that determines the browser type. And its structure is probably something like:


    
    

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    if (document.all) {
      document.write("Internet Explorer Detected");
    }
    else if (document.layers) {
      document.write("Netscape Navigator Detected");
    }
    else {
      document.write("Unrecognized Browser Detected");
    }
    // -->
    </SCRIPT>

    Try this script. Convince yourself it's working as expected in Internet Explorer and in Netscape Navigator. Try now in Netscape 6. You should get the "Unrecognized Browser Detection" message. Netscape 6 does not support document.all, nor does it support document.layers. Netscape 6 supports document.getElementById. But Internet Explorer supports this method as well, so you need to be careful how to write your new browser sniffer. See Webreference's updated sniffer for example. The script above should look like this now:

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    if (document.all) {
      document.write("Internet Explorer Detected");
    }
    else if (document.layers) {
      document.write("Netscape Navigator Detected");
    }
    else if (document.getElementById) {
      document.write("Netscape 6 Detected");
    }
    else {
      document.write("Unrecognized Browser Detected");
    }
    // -->
    </SCRIPT>

    Try this script. Notice the positive identification of Netscape 6.

    
    <SCRIPT LANGUAGE="JavaScript">
    
    <!--
    function oldSniffer() {
      if (document.all) {
        document.write("Internet Explorer Detected");
      }
      else if (document.layers) {
        document.write("Netscape Navigator Detected");
      }
      else {
        document.write("Unrecognized Browser Detected");
      }
    }
    
    function newSniffer() {
      if (document.all) {

        document.write("Internet Explorer Detected");
      }
      else if (document.layers) {
        document.write("Netscape Navigator Detected");
      }
      else if (document.getElementById) {
        document.write("Netscape 6 Detected");
      }
      else {
        document.write("Unrecognized Browser Detected");
      }
    }
    // -->
    
    </SCRIPT>
    

    Cross-Browser Scripting



  • Comment and Contribute

    Your name/nickname

    Your email

    (Maximum characters: 1200). You have characters left.


     

     


    Thanks for your registration, follow us on our social networks to keep up-to-date