Using hidden applet in ZK

asked 2014-01-22 10:55:08 +0800

venicum gravatar image venicum
21 4

updated 2014-01-22 11:03:38 +0800

My task is using hidden signed applet which support cryptography functions. Applet has to be loaded dynamically.

I try to use this example: (no links, just open first google search result from Oracle website) "invoking Applet Methods From JavaScript". The problem is when the applet is loaded and deployed with "deployJava.js" ZK window is disappearing.

My code is:

 function loadScript(url, callback)
      // Adding the script tag to the head as suggested before
      var head = document.getElementsByTagName('head')[0];
      var script = document.createElement('script');
      script.type = 'text/javascript';
      script.src = url;

      // Then bind the event to the callback function.
      // There are several events for cross browser compatibility.
      script.onreadystatechange = callback;
      script.onload = callback;

      // Fire the loading

 function startApplet() {
      var invokeApplet = function () {
      var attributes = { id:'cryptoApplet', code:'CryptoApplet',  width:1, height:1} ;
      var parameters = { jar: 'clientcrypto.jar'} ;
      deployJava.runApplet(attributes, parameters, '1.7');
      loadScript("/js/deployJava.js", invokeApplet);
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-03-06 18:41:30 +0800

venicum gravatar image venicum
21 4

updated 2014-03-06 18:43:28 +0800

The problem of disappearing happens because deployJava.js use "document.write(applet tag)" to add an applet. I add div component to the page which has width="1", height="1", and rewrite deployJava.js to append applet in that div. And it's worked.

So I add an applet to page dynamically with modified deployJava.js script.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2014-01-22 10:55:08 +0800

Seen: 15 times

Last updated: Mar 06 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More