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>
Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
| | | CSS David McFarland |
| | | |
HTML Gary B. Shelly, Th... | | |