Java vs. JavaScript IV
Typical Java applet Structure
- Java source --> javac compiler --> JavaVM Universal Machine code in .class file
- Store JavaVM .class files on Web Server
- Download JavaVM from Server to Client
- Interpreter built into browser, reads JavaVM and executes on client
- (User or System) Java event handlers interpret events within applet
Typical JavaScript Structure
- JavaScript Source is included in HTML text or special .js files included in HTML files
- Combined JavaScript and HTML is downloaded and interpreted by browser on client to produce HTML Page
- Events (not in applets but) in HTML Page (mouse clicks etc.) are either interpreted by browser default or overridden by user JavaScript code.