Search code examples
javajavascriptappletjsobject

Is there any way to know if the user has rejected the applet?


I am working on a web application. I first check whether Java is enabled or not on the browser. Now only if Java is enabled I load the applet, else I do not load the applet.

Now I have two cases:

  1. If the user accepts the applet, show div1
  2. If the user rejects the applet. show div2

If the user accepts the applet, my callback function in javascript is called and from there I show div1

But what if the user rejects the applet? How can I know if the user has rejected the applet and show div2?


Solution

    • Put a method in the applet that can be called by JS.
    • Write some JS that periodically tries to call the method.
    • If after a certain amount of time the applet has not responded, presume it failed to load and take further action.