SHARE
Facebook X Pinterest WhatsApp

Netscape 6, Part I: Detection and Scripting Page 2

Written By
thumbnail Yehuda Shiran
Yehuda Shiran
Dec 5, 2000
ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More



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:

    
    
    

    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:

    
    
    

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

    
    
    
    <!--
    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");
      }
    }
    // -->
    
    
    

    Cross-Browser Scripting

  • Recommended for you...

    What Is a Container? Understanding Containerization
    What Is a Print Server? | How It Works and What It Does
    Nisar Ahmad
    Dec 8, 2023
    6 Best Linux Virtualization Software for 2024
    What Is a Network Policy Server (NPS)? | Essential Guide
    ServerWatch Logo

    ServerWatch is a top resource on servers. Explore the latest news, reviews and guides for server administrators now.

    Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

    Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.