4

I have a digitally-signed Java applet. When the user visits the applet page on my website they are prompted whether to accept the signed applet or not.

How can I determine if the user has accepted the applet? Either from javascript/html, or from the applet itself (if the user clicks cancel, does it run with limited prvileges or does it not run at all?), or perhaps from another applet that is unsigned on the same page?

Textmode
  • 509
  • 3
  • 18
David Chen
  • 41
  • 1

2 Answers2

2

In your java applet init code segment, you can change a declared javascript variable value(ref: http://www.rgagnon.com/javadetails/java-0172.html). In your javascript, the domready event start monitor the javascript valriable. So, you can know user allow the java applet on the javascript variable changing.

erinus
  • 734
  • 4
  • 5
2

The code will run sand-boxed if the user refuses the digitally signed code.

Here is a demo of loading trusted applets in a defensive way that might be helpful.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • @Enrique The technique used is pretty basic. Just 'try' something that would not be allowed in a sand-boxed app. and do the alternative action in the 'catch' statement. AFAIR the trusted action was to establish a JFileChooser, but I would need to hunt down the original source to be sure. – Andrew Thompson Dec 25 '10 at 22:32
  • I am not sure this is valid information anymore, it appears to me as though the applet simply stops if the user clicks "cancel". I cannot get this to work in any fashion, unfortunately. Additionally, using erinus' suggestion is prone to error as well, since you can't detect if the dialog box is open, or they clicked cancel, so if you need to differentiate between the two conditions, that is not acceptable either. – LadyCailin Jun 26 '12 at 15:50
  • @wraithguard01 See [this question](http://stackoverflow.com/questions/5356850/does-this-applet-work-in-an-iced-tea-jre) for an update. – Andrew Thompson Jun 26 '12 at 19:41