Hot questions for Using Applets in browser

Question:

If I embed a Java applet in a browser, is there any way that the Java code can be seen on the client side?

Using HTML5, if the code can't be seen with a simple "Inspect Element," its source can eventually be retrieved.

If a Java applet is used, is the client-code absolutely hidden?


Answer:

As mentioned here:

The programs are first written in Java, compiled or translated to byte codes using a Java compiler, and when a Web browser retrieves a page with the Applet tag, the byte codes are sent to the computer viewing the Web page to be executed there.

That means you can see only the byte code, but not the Java source code.

Question:

Well, we are long past the days of ActiveX controls running in Internet Explorer so my question is how does java manipulate the browser into displaying the applet on the web page?


Answer:

how does java manipulate the browser into displaying the applet on the web page?

It doesn't. The user installs an NPAPI (Netscape Plugin API) plugin which tells the browser it can run Java applets. Then, when the browser sees a Java applet, it fires up the plugin.

It's worth noting that Chrome no longer supports the NPAPI on Linux, and they're scheduled to stop supporting it on Windows in September. As far as I know, officially Mozilla calls NPAPI plugins a "legacy" feature and recommends using other options, but is continuing to support them via click-to-play (at least for now)..

Question:

I have an Eclipse Java project, in which I have an src/demo package that contains a Processing demo, inside a single class that extends PApplet. The demo runs fine in Eclipse.

I wish to demo this package, preferably in a web browser. Being able to demo outside the Eclipse project would still be appreciated.

I've tried exporting the package to a JAR and embedding it in an HTML file. Firefox seems to be the only modern mainstream browser that supports NPAPI plugins like Java (Chrome 46 just shows a grey box, Safari 9 shows a blank page). Firefox kept throwing "Class/Library not found" errors, until I manually copied all the libraries to the same directory as a JAR and including them in archive attribute of the applet element in the HTML.

Now Firefox shows a black outline but a blank app, which might because I haven't copied assets from the data folder in Eclipse. I have no idea how to include them with the JAR however.

I tried following this guide and simply adding a main() to the PApplet but that gave me a "Class not found error" when I exported it as a runnable JAR and tried running it.

System information: Mac OS X 10.11.0, Java 1.8.60

What is the systematic way to go about all this?


Answer:

I think the best way to answer your question is to clear up some of the confusions you have about the issues you're experiencing.

First of all, applets are pretty much dead. They won't work at all in chrome, like you mentioned. Getting them to work in other browsers is a pain in the neck, for you and for your end users. You have to either pay for a certificate or get your users to change their Java security settings.

Furthermore, as of Processing 3, PApplet no longer extends Applet. So you can't simply extend PApplet and treat it as an applet anymore. (You forgot to tell us which version of Processing you're using.)

Honestly, the best approach is to forget about applets.

If you forget about applets, then you could deploy as a standard executable by going to file -> export, or as a runnable jar using something like JarMatey (full disclosure: I wrote JarMatey). It's important to note that it's not enough to simply add a main() function to your class.

But in my honest opinion, your best bet for deploying your Processing sketch is to use Processing.js to deploy as html5/JavaScript. This should be pretty easy, as long as you aren't using any Java libraries.

Question:

I know, no one uses applets now, but My Undergrad degree still have this in the syllabus!!

This is my HelloWorld.java file code

import java.applet.Applet;
import java.awt.Graphics;

public class HelloWorld extends Applet {
    public void paint(Graphics g) {
        g.drawString("Hello world!", 50, 25);
    }
}

This is my Hello.html file code

<html>
    <body>
        Here is the output of my program:
        <applet code="HelloWorld.class" width="150" height="25"></applet>
    </body>
</html>

Both the files are saved to desktop.

This is what I did:

  1. Open CMD
  2. Type cd desktop
  3. Type javac HelloWorld.java
  4. Open Hello.html file in Chrome, Opera, Firefox, Microsoft Edge

None of the browser runs the applet!! Normal Java (AWT) programs are running using CMD but not applet.

JDK & JRE version I am using is jdk1.8.0_201 & jre1.8.0_201 respectively.


Answer:

Use the commands below:

/*
<html>
<applet code="HelloWorld.class" CodeBase="" width=300 height=400></applet>
</html>
*/

save this as "HelloWorld.html"

c:\>javac HelloWorld.java
c:\>appletviewer HelloWorld.html

Question:

I have created a Java applet as part of a request from a client for a web-based program, and while I've gotten it embedded, Chrome has disabled support, you need to bypass various security protocols in both Internet Explorer and Firefox, and Edge doesn't have support for java in the first place. My question is, is there some sort of way we can run this program through a wrapper or an alternative way of getting it on the web without re-writing the entire program in a different language? Thanks!


Answer:

Realistically, as you're seeing, applets are dead. Your best option is to use Java Web Start and convert your applet into an application. That really isn't too bad to do but it will require some work.

Basically the server sends a JNLP file that runs an application. The application (i.e. your Java application) can be downloaded from a remote server so that you don't have to have pre-installed anything except for Java on the client machine.

Question:

I have created simple Applet Example. I have successfully created compiled and run it eclipse, but when i try to run in any of the browsers it shows..

unsupported major.minor version 52.0

I think the problem here is that i have java SE 1.8 64 bit installed on the system but browser is 32 bit and plugin points to jre1.7 32 bit, i have installed that also still the same error. If i forcefully try to compile my applet using 1.7 it show the following error.


javac: target release 1.7 conflicts with default source release 1.8

how should I resolve this...any suggestions?


Answer:

I made it working by compiling with the lower version of Java.

You can use javac -target 1.6 <source files>

If you're using some IDE to build jars, please specify which one.

Please see This link for details.

Question:

i would like to know if there is a tool which can help me to automate a java applet application in browser i tried to use FEST-Selenium but is there any other tools ? thank you


Answer:

After some research on Java Applet Automation i found some tools which can help to automate the Java Applets. Some of them you can Look for is LiveConnect and Robot. You can give a try with them.

Question:

I want to use java applet in dynamic web project but it's not working. I created small applet:

`public class MyApplet extends JApplet {
    static final long serialVersionUID = 1L;
    private JTextField textField;`

    /**
     * Create the applet.
     */
    public MyApplet() {
        getContentPane().setLayout(null);

        JLabel lblTag = new JLabel("Tag:");
        lblTag.setBounds(91, 51, 46, 14);
        getContentPane().add(lblTag);

        textField = new JTextField();
        textField.setBounds(126, 48, 86, 20);
        getContentPane().add(textField);
        textField.setColumns(10);

    }

}`

Then i putted it to .JAR file

Next i created Dynamic Web Project and allocate .JAR file in folder in which index.html file is.

I put also

`<applet code="MyApplet.class" archive="name.jar"   width="500" height="500" ></applet>`

to index.html file.

When i open this project on apache server i can see html file propertly with styles but aplet is not showing. It happend in every browser. I have not any error in console:

`sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version:        Apache Tomcat/8.5.37
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          Dec 12 2018 12:07:02 UTC
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number:         8.5.37.0
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Windows 10
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            10.0
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          amd64
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             C:\Program Files\Java\jre1.8.0_121
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           1.8.0_121-b13
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE:         C:\Users\Admin\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME:         C:\Users\Admin\Desktop\Projekty PWJJ\apache-tomcat-8.5.37\apache-tomcat-8.5.37
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\Admin\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Users\Admin\Desktop\Projekty PWJJ\apache-tomcat-8.5.37\apache-tomcat-8.5.37
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\Admin\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Users\Admin\Desktop\Projekty PWJJ\apache-tomcat-8.5.37\apache-tomcat-8.5.37\endorsed
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1250
sty 20, 2019 9:13:47 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jre1.8.0_121\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_121/bin/server;C:/Program Files/Java/jre1.8.0_121/bin;C:/Program Files/Java/jre1.8.0_121/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\MinGW\bin;C:\WINDOWS\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\Program Files\Git\cmd;C:\Users\Admin\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Nmap;C:\Users\Admin\AppData\Local\GitHubDesktop\bin;C:\WINDOWS\system32;;.]
sty 20, 2019 9:13:47 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
sty 20, 2019 9:13:47 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
sty 20, 2019 9:13:47 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
sty 20, 2019 9:13:47 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
sty 20, 2019 9:13:47 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 608 ms
sty 20, 2019 9:13:47 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
sty 20, 2019 9:13:47 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.37
sty 20, 2019 9:13:48 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
sty 20, 2019 9:13:48 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
sty 20, 2019 9:13:48 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 274 ms`

Answer:

This will not work with modern browsers. Java plugins allowing to run Applets are obsolete for quite some time now e.g. Firefox did this in 2016:

Websites and publishers which currently use plugins such as Silverlight or Java should accelerate their transition to Web technologies. The Web platform is powerful and can usually do everything that a plugin can do. In the rare cases where a site needs to extend Web technologies, the recommended solution is to develop the additional features as a Firefox add-on. Site maintainers should prepare for plugins to stop working in all versions of Firefox by the end of 2016.

Question:

I am trying to embed applet into an html page and view it in a browser, but i am unable to view it in any of the browsers. (Firefox, Chrome, Edge, Internet Explorer are the browsers i have checked, and also i have enabled the java applets in all of the above.)

Below is my code for applet.java file.

import java.applet.Applet;
 import java.awt.Graphics;

 public class MyApplet extends Applet {
     @Override
     public void paint(Graphics g) {
         g.drawString("Hello applet!", 50, 25);
     }
 }

Below is the code for html file.

<html>
<head>
    <title>First Applet</title>
</head>
<body>
    <p>This is my first applet.</p>
        <embed code="MyApplet.class" 
            codebase="."
            type="application/x-java-applet;version=1.8">
            <noembed>
                No Java Support.
            </noembed>
        </embed>
</body></html>

.class file, .java file and .html files are all in the same folder.


Answer:

Modern Browsers does not support java applets; as per below post on official Java website:

https://www.java.com/en/download/faq/chrome.xml

The Java Plugin for web browsers relies on the cross-platform plugin architecture NPAPI, which had been supported by all major web browsers for over a decade. Google's Chrome version 45 and above have dropped support for NPAPI, and therefore Java Plugin do not work on these browsers anymore.

Also, for edge, this stackover flow post indicates the same...

Question:

I've been browsing this site for some time, but this is my first official post.

I'm fairly new to Java (just getting started with applets), and I'm having trouble getting my assigned applet to run in a browser. Everything runs fine in Eclipse, but there is nothing but blank space when I open my .html file.

I'd greatly appreciate if anyone could look over what I have below and offer their expertise. I'm sure I've made some noob mistake and haven't been able to locate it yet. Thanks.

Java source code:

// Import necessary classes.
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

class Eye extends Thread
{
    public static int mouseXcoordinate;
    public static int mouseYcoordinate;
    private static final int EYEWIDTH = 50;
    private static final int EYEHEIGHT = 75;
    private static final int IRISSIZE = 30;
    private static final int PUPILSIZE = 12;
    private Color irisColor;
    private static final int SMALLXRAD = (EYEWIDTH  - IRISSIZE)/2;
    private static final int SMALLYRAD = (EYEHEIGHT - IRISSIZE)/2;
    private int x, y;
    private double newX, newY;
    private Graphics g;

    // Constructor for a new eye.
    public Eye(int x, int y, Graphics g)
    {
        this.g = g;
        this.x = x;
        this.y = y;

        // Choose random colors for the iris of the eyes.
        irisColor = new Color((float)Math.random(), (float)Math.random(), (float)Math.random());
    }

    // Draw the eye, in detail.
    private void draw()
    {
        synchronized(g)
        {
            // Erase any old eye color.
            g.setColor(Color.white);
            g.fillOval(x - EYEWIDTH/2, y - EYEHEIGHT/2, EYEWIDTH, EYEHEIGHT);
            // Draw the iris and set the color.
            g.setColor(irisColor);
            g.fillOval((int)newX - IRISSIZE/2 + 1, (int)newY - IRISSIZE/2 + 1, IRISSIZE, IRISSIZE);
            // Draw the pupil and set the color.
            g.setColor(Color.black);
            g.fillOval((int)newX - PUPILSIZE/2 + 1, (int)newY - PUPILSIZE/2 + 1, PUPILSIZE, PUPILSIZE);
            // Draw the eye outline.
            g.drawOval(x - EYEWIDTH/2, y - EYEHEIGHT/2, EYEWIDTH, EYEHEIGHT);
        }
    }

    // Continuously calculate the current coordinates and redraw the eyes to follow the coordinates.
    public void run()
    {
        for(;;)
        {
            updateCoordinates();
            draw();
            try
            {
                sleep(50);
            }
            catch (InterruptedException e)
            {}
        }

    }

    // Update the mouse coordinates.
    private void updateCoordinates()
    {

        if (mouseXcoordinate == x)
        {
            newX = mouseXcoordinate;

            if (Math.abs(y - mouseYcoordinate) >= SMALLYRAD)
            {
                if ( (y - mouseYcoordinate) > 0 )
                    newY = y - SMALLYRAD;
                else
                    newY = y + SMALLYRAD;
            }
            else
                newY = mouseYcoordinate;
            return;
        }

        // Find intersection point of line to mouse with eye ellipse
        double slope = (double)(mouseYcoordinate - y) / (double)(mouseXcoordinate - x);
        double numerator = SMALLXRAD * SMALLXRAD * SMALLYRAD * SMALLYRAD;
        double denominator = SMALLYRAD * SMALLYRAD + slope * slope * SMALLXRAD * SMALLXRAD;
        newX = Math.sqrt(numerator / denominator);
        newY = slope * newX;

        // Choose appropriate intersection point
        if (mouseXcoordinate < x)
            newX = -Math.abs(newX);
        else
            newX = Math.abs(newX);

        if (mouseYcoordinate < y)
            newY = -Math.abs(newY);
        else
            newY = Math.abs(newY);

        newX += x;
        newY += y;

        if ( (double)(mouseXcoordinate - x)*(mouseXcoordinate - x) / (SMALLXRAD * SMALLXRAD) + (double)(mouseYcoordinate - y)*(mouseYcoordinate - y) / (SMALLYRAD * SMALLYRAD) < 1 )
        {
            newX = mouseXcoordinate;
            newY = mouseYcoordinate;
        }
    }
}

@SuppressWarnings("serial")
public class BurleighWatchMe extends Applet
{
    static final int NUM_EYES = 50;
    Eye[] eyes = new Eye[NUM_EYES];
    int count = -1;
    int width, height;

    // Initializes the applet by loading coordinates and starting two eye threads.
    public void init()
    {
        addMouseMotionListener( new MouseMotionListener()
        {
            public void mouseDragged(MouseEvent e) {}
            public void mouseMoved(MouseEvent e)
            {
                Eye.mouseXcoordinate = e.getX();
                Eye.mouseYcoordinate = e.getY();
                repaint();
            }
        });
    }

    // Starts the eye threads.
    public void start()
    {
        if (count == -1)
        {
            width = getSize().width;
            height = getSize().height;
            final Graphics g = getGraphics( );
            eyes[++count] = new Eye(width/4,   height/2, g);
            eyes[count].start();
            eyes[++count] = new Eye(3*width/4, height/2, g);
            eyes[count].start();
        }

    repaint();
    }

    // Redraws a border around the applet.
    public void update(Graphics g)
    {
        g.drawRect(0,0,width-1,height-1);
    }
}

HTML:

<html>
<head>
    <title>Watch Me Eyes</title>
</head>
<body>
    Move your mouse pointer over these<br />eyes, and watch them follow it!
    <p />
    <applet code="BurleighWatchMe.class" width="400" height="400">
    </applet>
</body>
</html>

Answer:

In the HTML code, you've missed out on adding the codebase attribute of the applet tag. Codebase refers to the directory containing your applet. So IF THE APPLET IS NOT IN THE SAME DIRECTORY AS THE HTML PAGE then you have to add the codebase attribute inside the applet tag. It would take the form below:

<applet>
    codebase="E:\Projects\" code="BurleighWatchMe.class" height="400" width="400"
</applet>

assuming that the BurleighWatchMe.class exists in the directory E:\Projects.

However, if the BurleighWatchMe.class file exists in the same directory as the HTML page and you're still seeing a blank page, then it probably might have been caused because the JRE on your system doesn't allow unknown applets. What you have to do is edit the settings to allow local applets. To do that, go to Start > Configure Java. Go to the Security tab of the Java settings dialog box. In the lower half of the window, you can see a Site Exception List. Beside that, there's a button called Edit Site List.... Click on that button. You'll see a list of sites whose applets you can run. Click on Add to add a new location. In the new field, type file:/// and press enter,. It'll show you a warning; click on Continue. Now click on OK and quit the Configure Java program.

Next, restart the browser. You'll see a dialog box when the applet loads wherein you have to select the Run option. You should now be able to run the applet on your browser.

Please note that Google Chrome no longer supports applets. The only browsers I know of that support applets are Firefox and Internet Explorer. I tested it and it worked on these two browsers.

See if it solves your problem.

Question:

Just want to try running applet on my browser, so I made a simple program:

import java.awt.*;
import javax.swing.*;

public class NotHelloWorldApplet extends JApplet {
    public void init() {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                JLabel label = new JLabel("Hello World applet",    SwingConstants.CENTER);
                add(label);
            }
        });
    }
}

And here is my HTML file:

<html>
    <head>
        <title> Hello World Applet</title>
    </head>
    <body>
        <applet code=“HelloWorldApplet.class” width=“300” height=“300”>
        </applet>
    </body>
</html>

And here is my browser configuration:

Everything looks great, but when I run my HTML file, it doesn't work. It simply show the content:

I can view it on Eclipse, just cannot view it on the browser. Is there anything I made it wrong?


Answer:

  1. Save it as file.html
  2. Open it through your web browser

Can you open other HTML files from your browser?

Question:

I can't run my Java applet in any browser - Java blocks it for security reason. I have Java 8, so I can't set security settings to medium. What I have to do? (in my own applets I mean applets that I wrote and it can't harm anything)


Answer:

We have to sign the applet before running it on the browser did you try signing your applet Jar. here is the signing commands.

You should be in the same directory in command prompt.

1.keytool -genkey -keyalg rsa -alias m4key  //m4key unique key
2.keytool -export -alias m4key -file bmcert.crt   //bmcert.crt certificate name
3.jar tvf Jarname.jar verify jar
4.jarsigner Jarname.jar m4key
5.jarsigner -verify -verbose -certs JarnameJarname.jar

But As you have mentioned you are using Java 8 , A self signed jar is not allowed to run in the browser due to security reasons.

So

Please open configure java in settings and in security TAB put the URL of the html page which is using applet in Exception Site List

Question:

I want to add progress bar when the applet is loaded on all browsers (Google Chrome, Mozilla Firefox , Internet Explorer , Safari, Opera) . I try to make this with javascript and html body onload method. I use below code..

<html>
    <head>
      <title>Your Title Here</title>
    </head>

   <script src="/jquery.js" type="text/javascript">
  </script> 
  <script src="/jquery.browser.js" type="text/javascript">
  </script> 
  <script language="JavaScript" type="text/javascript">

//if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){
//alert("firefox"); 
 //}



function init() {


var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;                    
var isFirefox = typeof InstallTrigger !== 'undefined';                                                             
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor')>0;      
var isChrome = !!window.chrome && !isOpera;                                                                    
var isIE = /*@cc_on!@*/false || document.documentMode; 

if(isIE == 11)
{

if(document.applets[0].visibility="visible")
{
alert("Loading On Internet Explorer");
document.all.loading.style.visibility="hidden";
}
}


if(isChrome == true)
{
//alert("Google Chrome");
if(document.applets[0].visibility="visible")
{
alert("Loading On Google Chrome");
document.all.loading.style.visibility="hidden";
//alert("Loading On Google Chrome");
//alert("internet explorer");
//alert("Loading...");
//document.writeln( "User Agent        = " + navigator.userAgent );
//document.loading.visibility="hidden";
//document.all.loading.style.visibility="hidden";
}
}




if(isFirefox == true)
{
//alert("mozilla firefox");
if(document.applets[0].visibility="visible")
{
alert("Loading On Mozilla Firefox");
document.all.loading.style.visibility="hidden";
//alert("internet explorer");
//alert("Loading...");
//document.writeln( "User Agent        = " + navigator.userAgent );
//document.loading.visibility="hidden";
//document.all.loading.style.visibility="hidden";
}
}


if(isSafari == true)
{
//alert("Safari");
if(document.applets[0].visibility="visible")
{
alert("Loading On Safari");
//alert("internet explorer");
//alert("Loading...");
//document.writeln( "User Agent        = " + navigator.userAgent );
//document.loading.visibility="hidden";
//document.all.loading.style.visibility="hidden";
}
}



 }





    </script>

    <style type="text/css">

      #loading {
        position:absolute;
        left:150;
        top:200;
      }

      #myapplet {
        position:absolute;
        left:10;
        top:10;
        visibility:hide;
      }

    </style>

    <body onLoad="init()">

      <div id="loading">
        <p>Loading  applet, please wait.</p>
      </div>


        <applet archive="app1.jar" code="app1.class" align="baseline" width="620" height="442">
          <p>Requires a browser that supports Java.</p>
        </applet>
      </div>

    </body>
  </html>

Above code works true on internet explorer but not work true on firefox and chromium. Progress Bar disappear when install plugin pop up message is shown in mozilla firefox before applet fully loaded. This progress bar must disappear after applet fully loaded. How can i do this with mozilla firefox and google chromium correctly. Should i use different codes for each browsers..


Answer:

"I want to add progress bar when the applet is loaded on all browsers". With using javascript and html u can't understand applet is loaded on browsers. You are dealing unnecessary things. I suggest you to read this discussion.How To Show Progress Bar When The Java Applet Load On Web Browser

Question:

I'm trying to use an applet to recovery some old data on a 3rd party site that i wished to keep. I see that nowadays all browser that i know force java plugin to be unavailable, is there some technical workaround to allow current and future applet execution for the sake of data migration? i looked into Lobo browser and JWebPane but to no avail


Answer:

Don't know about modern browser compatibility. You should still be able to use and older version of a compatible browser - I'd just be extra carefull as security fixes would obviously be absent.

This post might old some good infos on the subject: https://superuser.com/questions/999778/when-firefox-drops-java-applet-support-how-will-i-run-old-java-applets

However, keep in mind that the very existence of the applet plugin will cease with Java 9. I'd hurry to find a more futur-proof solution.