iLTC Home
Bookmark iLTC!

Categories

Perl
  • Perl Tutorials Beginners

  • Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

  • HTML
  • HTML Tutorials

  • Command Line
  • Command Line Tutorials

  • How Tos
  • Other Tips and Tricks



  • I love the code... dot com
    1721537

    iLoveTheCode.com

    Environmental Variables Available in Javascript using Navigator Object

    Most environmental variables available in Perl and PHP are not accessible in Javascript.

    But there are still some very useful bits that might help you in your programming needs.

    You can access them via the navigator object like so:

    document.write(navigator.appName);

    Which prints:
    Netscape

    ... on my machine since I use Firefox on Mac.


    Or store their value in your own variable like this:


    var ji = navigator.appName;

    document.write(ji);

    Which prints:
    Microsoft Internet Explorer

    ... on my test machine over my shoulder that runs Windows XP.


    NOTES:
    - As always, the availability of the following environmental variables will depend on the user's Operating System and browser type. Example: cpuClass returns undefined if the user is on Firefox for Mac.
    - For more detailed info on this topic click here to search google for javascript navigator object (new window).



    Free Copy and Paste Javascript Code:

    <script type="text/javascript">
    <!--

    document.write("<br>appName is ");
    document.write(navigator.appName);
    document.write("<br>appCodeName is ");
    document.write(navigator.appCodeName);
    document.write("<br>appVersion is ");
    document.write(navigator.appVersion);
    document.write("<br>appMinorVersion is ");
    document.write(navigator.appMinorVersion);
    document.write("<br>userAgent is ");
    document.write(navigator.userAgent);
    document.write("<br>platform is ");
    document.write(navigator.platform);
    document.write("<br>cookieEnabled is ");
    document.write(navigator.cookieEnabled);
    document.write("<br>userLanguage is ");
    document.write(navigator.userLanguage);
    document.write("<br>systemLanguage is ");
    document.write(navigator.systemLanguage);
    document.write("<br>cpuClass is ");
    document.write(navigator.cpuClass);
    document.write("<br>onLine is ");
    document.write(navigator.onLine);
    document.write("<br>");
    document.write("<br>Method for testing Java Enabled (Use parenthesis):");
    document.write("<br>javaEnabled is ");
    document.write(navigator.javaEnabled());

    -->
    </script>




    Previous Article: If, Else If, and Else in Javascript
    Next Article: Splitting an Array using Javascript






    Search iLTC w/ Google




    Recent Articles

  • HTML Font Code
  • Javascript and CSS - Easy Pop Up Help Balloons
  • Use OnMouseOver in Javascript
  • Use onMouseOut in Javascript
  • Use innerHTML to Change Text on a Page
  • Renaming a File with Perl's RENAME Function
  • PRINT to Browser with document.write Command in Javascript
  • Passing an Argument or Variable to a Javascript
  • Opening an Alert Box in Javascript
  • Opening a REMOTE WINDOW in Javascript
  • OPEN and WRITE a Data File in Perl
  • OPEN and READ a Data File in Perl
  • Mimic Typing from a Textfield in a Textarea with Javascript
  • Javascript Reset Form








  • Perl Programming - Javascript Programming - HTML Code - Mac Unix Command Line - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006-2009 iLoveTheCode.com


    Contact Chris | About this Site


    1721265
    Counter by iLoveTheCode.com


    Last Modified: Saturday, 10-Jan-2009 05:40:24 EST



    Hosted as well :)
    Home-brewed logo - 1997