JavaScript : Java Glossary

JavaScript
a scripting language embedded in HTML (Hypertext Markup Language) originally pioneered by Netscape, then adopted in variants by all the major browsers. JavaScript is very different from Java that can be interpreted by the browser. Questions about JavaScript should be directed to comp.lang.javascript  not comp.lang.java .

I utterly detest JavaScript. I don’t like the deception inherent in its name. I don’t like the idea of sending bulky source code around when you could be sending nice compact byte codes, though I must admit the openness has been great since every program acts as a programming tutorial. I don’t like the idea of proprietary Chinese-menu feature set Internet languages. Granted JavaScript is not as disgusting and dangerous as ActiveX since it has its own sort of sandbox — missing language features. I don’t like the way JavaScript is so often used to annoy the heck out of users by making it impossible to leave a site without rebooting. I find the things people tend to do with it are annoyingly cheap and flashy.

JavaScript has been around a long time and more often than not a site with JavaScript will not render properly, and will behave differently with different browsers. To me, using JavaScript is like serving your guests gilded dog feces. It should be stomped out. It is fundamentally flawed and cannot be fixed, any more than a car made of grass clippings could ever run properly. So I have so far avoided it and usually have it turned off in my browsers. The only place I used it on my website are for webring nav bars there I had no choice.

The ECMA (European Computer Manufacturer’s Association) standard version of JavaScript is called ECMAScript. Microsoft has a extension of ECMAScript they call they call Jscript.

Superficially, JavaScript looks a bit like Java crossed with Pascal. Strings may be enclosed in either " or '. Semicolons are separators rather than terminators, as in Pascal. there is an explicit function keyword to make the start of each method. Each declaration is explicitly marked with the keyword var, as in languages designed for each of maintenance.

JavaScript causes havoc in pages when you use them off-line if they try to fetch material from the Internet, blocking page rendering. You can disable JavaScript while off-line with the defer parameter. Unfortunately only Opera and Firefox support in properly both online and off-line. Mozilla, Netscape ignore it. IE (Internet Explorer) screws it up totally. To be fair, the original definition was that the script generated no output, so

<!-- for conventional HTML -->
<script type="text/javascript" src="myScript.js" defer></script>

<!-- for XHTML -->
<script type="text/javascript" src="myScript.js" defer="defer"></script>
To my horror, Sun recommends using JavaScript to deploy Java Applets and applications.
Be wary of embedding JavaScript provided by others in your web pages. If you view those pages locally, the JavaScript can potentially send information from your hard disk to a website on the other side of the world. Scrutinise it for suspicious code.

Useful JavaScript Expressions

Useful JavaScript Expressions
PurposeExpressionHow it RendersNotes
Ensure Java Installed if( deployJava.versionCheck( '1.7.0' ) ) document.write( 'java 1.7.0+ installed on the desktop' ); java 1.7.0+ installed on the desktopWorks in all major browsers. Must load deployjava.js first.
Browser Detectdocument.write( deployJava.getBrowser() );Netscape familyUseless except for IE. Must load deployjava.js first.
Browser Detect IIdocument.write( navigator.appname );NetscapeUseless except for IE and Opera
Ensure Any Java Plugin installedif ( navigator.javaEnabled() ) document.write( 'Java plug-in installed in browser' );Java plug-in installed in browser Works in all major browsers
Ensure Plugin-2 installedif ( deployJava.isPlugin2() ) document.write( 'Java plug-in-2 installed in browser' );Java plug-in-2 installed in browser Does not work in Opera or Safari

Browser Detect

I wrote this browser detect in frustration with all the existing ones. This is one easy to extend with other browsers.

1984

If you allow JavaScript to run on your machine, you enter the world of 1984 when every keyclick, everything you look at is potentially monitored. Your webcam feed can be turned on. The catch is corporations have arranged that if you turn off JavaScript their websites stop working entirely. They want to spy on you.

Learning More

Oracle’s Technote Guide on using deployjava.js : available:

CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/javascript.html J:\mindprod\jgloss\javascript.html
logo
Please email your , letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email. If you want your message, your name or email kept confidential, not considered for public posting, please explicitly specify that. Unless you state otherwise, I will treat your message as a letter to the editor that I may or may not publish in the feedback section. After that, it will be too late to retract it. If you disagree with something I said, please quote it and cite the web page where you found it, tell me why you think it is wrong, and, if possible, provide some supporting evidence. Threatening to kill me or spouting obscenities has yet to persuade me to change my mind.
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.179.210]
You are visitor number 16,778.