File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Applets
Bookmark ""Java Applet Window" warning shows with signed applet when called from JavaScript" Watch ""Java Applet Window" warning shows with signed applet when called from JavaScript" New topic
Author

"Java Applet Window" warning shows with signed applet when called from JavaScript

Kevin Draper
Greenhorn

Joined: Nov 09, 2004
Posts: 1
We have a signed applet that we are using on an HTML page. The applet has lots of popup-windows that, because the applet is signed, do not show the "Java Applet Window" warning at the bottom of the page - so far so good.

However, if the user switches away from the current window, we want to save some values from the applet. To do this, we have the following



This calls into the applet and causes a dialog window to be displayed asking the user if they want to save their settings. But, when this window is displayed, the dreaded "Java Applet Window" warning is displayed at the bottom of the window.

Can some one explain to me how this is happening with a signed applet? I have verified this behaviour with both IE 6.0 and Firefox 1.0.

Thank you

Kevin.
David Morgan
Greenhorn

Joined: Dec 18, 2008
Posts: 1
So, I know this is really really old, but I'm seeing the same problem.

I'm running a signed applet, and only the frames launched from JavaScript show the warning banner (icon now in 1.6)

Anyone have any info on this? I haven't been able to find out much about it.

Regards,
David Morgan
Kc Wong
Greenhorn

Joined: May 13, 2010
Posts: 1
David Morgan wrote:So, I know this is really really old, but I'm seeing the same problem.

I'm running a signed applet, and only the frames launched from JavaScript show the warning banner (icon now in 1.6)

Anyone have any info on this? I haven't been able to find out much about it.


Hmm... I know this is really really really really old, but I have a workaround now. Ugly, yes, but it got rid of the icon.

Same scenario with the above two posters: signed applet that creates a new dialog/frame when invoked by JavaScript.

I created a JDialog first, then called its setVisible() in these locations and FAILED:

1. AccessController.doPrivileged() - checkPermission(new AWTPermission("showWindowWithoutWarningBanner")) didn't even throw exception. Yet I got the icon.

2. AccessControlContext - I saved the instance from applet with AccessController.getContext(), and use it during doPrivileged(). checkPermission still okay and still got icon.

3. SwingUtilities.invokeLater() - Thinking the information may be carried by the current thread, I tried using another thread. Icon again.

4. Background thread - I created a background thread, and the function invoked by JavaScript sent a signal. Still had icon.


At this point I thought it had something to do with when the JDialog was constructed. So for 3. and 4. I moved the JDialog construction code inside - and the background thread method worked. Looks like SwingUtilities carried over the "insecure context" information as well.

So in summary:
1. Create a background thread in applet.
2. JavaScript invokes a method in applet that sends a signal to background thread.
3. Background thread receives the signal, creates the dialog and displays it.
4. Background thread passes the created dialog back to caller, so you can access the created dialog's methods and properties.
 
Don't get me started about those stupid light bulbs.
 
subject: "Java Applet Window" warning shows with signed applet when called from JavaScript