You are here: irt.org | FAQ | Java | Q4080 [ previous next ]
The applet source code is never in your html page. The HTML page contains only a reference to the applet class that is residing on the server side. When the HTML page is loaded on to the client browser the HTML interpreter interprets each and every tag. when it finds the applet tag it requests the web server to serve the same class file which is referenced in the applet code attribute.
If this file is available on the specified location then it is served. Once this class file is loaded on to the client side. The browser loads the Java runtime which normally comes inbuilt with various browsers. This Java runtime works exactly in the same as the Java interpreter "java" . It executes that class. So there is no question of having the code in HTML page.
This is not the case in JavaScript. There are two types of scripting Client Side and Server Side Scripting . In Client Side Scripting the entire JavaScript code is loaded into the HTML page, it is interpreted by the browser if it is JavaScript enabled. In Server Side Scripting the results are computed by the web server and then forwarded to the client browser.