JavaScript : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

JavaScript
Introduction 1984
Rant Why Has JavaScript Prevailed
Useful JavaScript Expressions Books
Browser Detect Learning More
Placement Links

Introduction

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.

Rant

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.

JavaScript programs are similar to unsigned Applets in that they run in a sandbox. They are blocked from doing the following:

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 offline if they try to fetch material from the Internet, blocking page rendering. You can disable JavaScript while offline with the defer parameter. Unfortunately only Opera and Firefox support in properly both online and offline. 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

To my horror, Oracle 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.

Perhaps the most infuriating feature of JavaScript is the way it makes screenscraping so difficult. The rendered screen looks almost nothing like the received page. On top of that, the page usually contains huge amounts of junk and duplication to further hide the data you are trying to scrape.

Useful JavaScript Expressions

Useful JavaScript Expressions
Purpose Expression How it Renders Notes
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 desktop Works in all major browsers. Must load deployjava.js first.
Browser Detect document.write( deployJava.getBrowser() ); Netscape family Useless except for IE. Must load deployjava.js first.
Browser Detect II document.write( navigator.appname ); Netscape Useless except for IE and Opera
Ensure Any Java Plugin installed if ( navigator.javaEnabled() ) document.write( 'Java plug-in installed in browser' ); Java plug-in installed in browser Works in all major browsers
Ensure Plugin-2 installed if ( 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.

Placement

The W3C (World Wide Web Consortium) spec says that you can insert scripts or script loads anywhere in the header or body. It will probably work fastest if you put them at the very end, just before </body>

In some cases you must insert scripts at a spot on the page where you want some widget to appear. Sometimes you mark the place you want the widget to occur with a magic ID and put the scripts at the bottom and execute them only after the whole page is loaded.

Scripts seemingly randomly work when you place them in the header, the body and the end of the body and whether you use defer or async. I have no better strategy that trying all possibilities. Spit!

Logically, they should all go at the very end, unless they are needed to render the top visible part of the page. You don’t want to hold up rendering while you load some script that will not have any visible effect until the user scrolls down.

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.

Why Has JavaScript Prevailed

Why has JavaScript, despite all its faults, prevailed while Applets have withered away. Joshua Cramer offers this explanation:

There are two reasons why JavaScript could be perceived to be less vulnerable:

  1. Most of the code is provided as part of the web browser, so security holes will naturally be fixed as the browser is updated, instead of waiting for another program to update.
  2. The Java applet model (to me, at least) is basically taking a full platform library and ensconcing it in a sandbox by turning off every API (Application Programming Interface) that is suspicious. The JS model is largely creating the APIs (Application Programming Interfaces) from scratch with the browser sandbox in mind--in effect, Java tries to blacklist insecure things while JS tries to whitelist secure things. Whitelists are inherently more secure than blacklists.

Oracle really dropped the ball on Applets. It seems that they decided that trying to provide (and maintain) a security sandbox was too hard, and instead wanted to merely require signing, which from a security standpoint, is like asking the code are you secure? — history has shown that users routinely ignore the contents of security dialogs, so giving a basically unrestricted sandbox to anyone who can prove authenticity (i.e., pay a few dollars to a CA) makes any claims of security really laughable.

Could it happen to JavaScript as well? Possibly, but rather unlikely in my estimation. There is strong demand for client-side interactivity. Given the resistance to major players to using any other language than JS builtin to the browser, JS looks set to basically be the necessary client-side interactive language for at least a decade to come.

Java applets were largely killed by Flash, I think, not JavaScript. By the late 2000’s, the only Java applets I generally saw were the simple applets used to illustrate something (e.g., this is how an AVL tree balances) — most of the interactive multimedia used Flash.

JavaScript has access to the HTML parse tree. You can examine it and modify it. This allows you to play all manner of silly games without having to parse anything yourself.

I think Java fell into disfavor in large measure because it is very slow to startup, [It is not so much is was slow to start up as the startup was not bundled as part of the browser setup, but instead of background load, loading was postponed until the first minor Applet, so the overhead got fully blamed on Java, where it appeared to be zero for JavaScript. Further JavaScript fat download penalty appeared to be just slow website response time, not JavaScript’s fault.] and also the unsigned sandbox may have been a little too tight for some people. Flash fell into disfavor because it is unstable (I have more issues due to Flash than I do due to the browser — and I run bleeding-edge nightlies). Silverlight was born in the dying days of plugins and never had much favor to begin with.

Books

book cover recommend book⇒Understanding ECMAScript 6: The Definitive Guide for JavaScript Developersto book home
by Nicholas C. Zakas 978-1-59327-757-4 paperback
birth 1978-07-12 age:38
publisher No Starch Press
published 2016-09-30
Due out 2016-09-30. Early access eBook availabe directly from the publisher.
Australian flag abe books anz abe books.ca Canadian flag
German flag abe books.de amazon.ca Canadian flag
German flag amazon.de Chapters Indigo Canadian flag
Spanish flag amazon.es Chapters Indigo eBooks Canadian flag
Spanish flag iberlibro.com abe books.com American flag
French flag abe books.fr amazon.com American flag
French flag amazon.fr Barnes & Noble American flag
Italian flag abe books.it Nook at Barnes & Noble American flag
Italian flag amazon.it Kobo American flag
India flag junglee.com Google play American flag
UK flag abe books.co.uk O’Reilly Safari American flag
UK flag amazon.co.uk Powells American flag
UN flag other stores
Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder.
book cover recommend book⇒Learning ECMAScript 6to book home
by Narayan Prusty 978-1-78588-444-3 paperback
publisher Packt Publishing - ebooks Account 978-1-78588-653-9 eBook
published 2015-10-01 B012O8SE6C kindle
Uses examples. You can download the eBook free.
Australian flag abe books anz abe books.ca Canadian flag
German flag abe books.de amazon.ca Canadian flag
German flag amazon.de Chapters Indigo Canadian flag
Spanish flag amazon.es Chapters Indigo eBooks Canadian flag
Spanish flag iberlibro.com abe books.com American flag
French flag abe books.fr amazon.com American flag
French flag amazon.fr Barnes & Noble American flag
Italian flag abe books.it Nook at Barnes & Noble American flag
Italian flag amazon.it Kobo American flag
India flag junglee.com Google play American flag
UK flag abe books.co.uk O’Reilly Safari American flag
UK flag amazon.co.uk Powells American flag
UN flag other stores
Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder.
book cover recommend book⇒Head First JavaScript Programmingto book home
by Eric T. Freeman, Elisabeth Robson 978-1-4493-4013-1 paperback
publisher O’Reilly recommended 978-1-4493-4398-9 eBook
published 2014-04-10 B00J9TMSDU kindle
Lighter approach.
Australian flag abe books anz abe books.ca Canadian flag
German flag abe books.de amazon.ca Canadian flag
German flag amazon.de Chapters Indigo Canadian flag
Spanish flag amazon.es Chapters Indigo eBooks Canadian flag
Spanish flag iberlibro.com abe books.com American flag
French flag abe books.fr amazon.com American flag
French flag amazon.fr Barnes & Noble American flag
Italian flag abe books.it Nook at Barnes & Noble American flag
Italian flag amazon.it Kobo American flag
India flag junglee.com Google play American flag
UK flag abe books.co.uk O’Reilly Safari American flag
UK flag amazon.co.uk Powells American flag
UN flag other stores
Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder.
book cover recommend book⇒JavaScript: The Definitive Guide: Activate Your Web Pagesto book home
by David Flanagan 978-0-596-80552-4 paperback
publisher O’Reilly recommended 978-1-4493-0816-2 eBook
published 2011-05-13 B004XQX4K0 kindle
6th edition. The eBook is unusually costly. The author also wrote the venerable Java is a Nutshell.
Australian flag abe books anz abe books.ca Canadian flag
German flag abe books.de amazon.ca Canadian flag
German flag amazon.de Chapters Indigo Canadian flag
Spanish flag amazon.es Chapters Indigo eBooks Canadian flag
Spanish flag iberlibro.com abe books.com American flag
French flag abe books.fr amazon.com American flag
French flag amazon.fr Barnes & Noble American flag
Italian flag abe books.it Nook at Barnes & Noble American flag
Italian flag amazon.it Kobo American flag
India flag junglee.com Google play American flag
UK flag abe books.co.uk O’Reilly Safari American flag
UK flag amazon.co.uk Powells American flag
UN flag other stores
Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder.
book cover recommend book⇒JavaScript: The Good Partsto book home
by Douglas Crockford 978-0-596-51774-8 paperback
birth 1955 age:61 978-0-596-55487-3 eBook
publisher Yahoo Press B0026OR2ZY kindle
published 2008-05
Most programming languages contain good and bad parts, but JavaScript has more than its share of the bad, having been developed and released in a hurry before it could be refined. This authoritative book scrapes away these bad features to reveal a subset of JavaScript that’s more reliable, readable and maintainable than the language as a whole — a subset you can use to create truly extensible and efficient code.
Australian flag abe books anz abe books.ca Canadian flag
German flag abe books.de amazon.ca Canadian flag
German flag amazon.de Chapters Indigo Canadian flag
Spanish flag amazon.es Chapters Indigo eBooks Canadian flag
Spanish flag iberlibro.com abe books.com American flag
French flag abe books.fr amazon.com American flag
French flag amazon.fr Barnes & Noble American flag
Italian flag abe books.it Nook at Barnes & Noble American flag
Italian flag amazon.it Kobo American flag
India flag junglee.com Google play American flag
UK flag abe books.co.uk O’Reilly Safari American flag
UK flag amazon.co.uk Powells American flag
UN flag other stores
Greyed out stores probably do not have the item in stock. Try looking for it with a bookfinder.

Learning More

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


This page is posted
on the web at:

http://mindprod.com/jgloss/javascript.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\javascript.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[54.161.168.87]
You are visitor number