Results 1 to 3 of 3

Thread: Detect NS6

  1. #1

    Thread Starter
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    How would i detect netscape 6 within a javascript, and distingush between netscape 4.7 and earlier, with NS6?

    for example:

    //var IE = (document.all)? 1 : 0;
    //var NS = (document.layers)? 1: 0;

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Why do you need to determine if NS6 is being used?


    navigator.appVersion returns 5.0 (Windows; en-US) for ns 6 and 4.02 [en] (WinNT; I ;Nav) for ns 4.2 so

    with ns6
    var ns = (document.layers)? 1: 0;
    is set to 0 !

    Code:
    var app = navigator.appName;
    var ver = navigator.appVersion;
    
    document.write(app + "<BR>")
    document.write(ver+ "<BR>")
    
    var ie4 = (document.all)? true : false; 
    var ns4 = (document.layers)? true : false;
    var ns = (app == "Netscape");
    var ns6 = ns && (navigator.appVersion.charAt(0)== 5)? true : false;
    
    document.write('IE 4: ' + ie4 + "<BR>");
    document.write('Netscape: ' + ns + "<BR>");
    document.write('Netscape 4: '+ ns4 + "<BR>");
    document.write('Netscape 6: ' + ns6 + "<BR>");

    this displays:

    IE5:
    Code:
    Microsoft Internet Explorer
    4.0 (compatible; MSIE 5.01; Windows NT)
    IE 4: true
    Netscape: false
    Netscape 4: false
    Netscape 6: false
    netscape 4:
    Code:
    Netscape
    4.02 [en] (WinNT; I ;Nav)
    IE 4: false
    Netscape: true
    Netscape 4: true
    Netscape 6: false
    netscape 6:
    Code:
    Netscape
    5.0 (Windows; en-US)
    IE 4: false
    Netscape: true
    Netscape 4: false
    Netscape 6: true
    is this of any help to you?

    Mark
    -------------------

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    sail3005

    DID MY LAST REPLY HELP?

    If you don't give me any feed-back I won't bother answering your questions in future!!
    Mark
    -------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width