What is an Applet in Java ?
An Applet is a small java program that runs in a Java enabled web browser. Java Applet is a small piece of java code that is embedded into HTML page, which gets executed when the HTML page loads into the browser.Applets provide powerful client-side functionality. As applets are loaded from remote machines and executed on client-side, there are various security restrictions on applets. Let us look into various Applets advantages and Applets Restrictions in brief :
Applets have many advantages over stand-alone application. Some of them are :
- As applet is a small java program, so it is platform independent code which is capable to run on any browser.
- Applets can perform various small tasks on client-side machines. They can play sounds, show images, get user inputs, get mouse clicks and even get user keystrokes, etc ...
- Applets creates and edit graphics on client-side which are different and independent of client-side platform.
- As compared to stand-alone application applets are small in size, the advantage of transferring it over network makes it more usable.
- Applets run on client browser so they provide functionality to import resources such as images, audio clips based on Url's.
- Applets are quite secure because of their access to resources.
- Applets are secure and safe to use because they cannot perform any modifications over local system.
- Various small tasks such as performing login, inventory checking, task scheduling can be done by applets running over Intranets.
- Applets have many restrictions over the areas of security because they are obtained from remote machines and can harm client-side machines. Some of them are as follows :
- If we are running an applet from a provider who is not trustworthy than security is important.
- Applet itself cannot run or modify any application on the local system.
- Applets has no access to client-side resources such as files , OS etc.
- Applets can have special privileges. They have to be tagged as trusted applets and they must be registered to APS (Applet Security Manager).
- Applet has little restriction when it comes to communication. It can communicate only with the machine from which it was loaded.
- Applet cannot work with native methods.
- Applet can only extract information about client-machine is its name, java version, OS, version etc ... .
- Applets tend to be slow on execution because all the classes and resources which it needs have to be transported over the network.
For more of such hot topics read my other posts here :