I should add that it was not possible to use scripts unchanged.  They needed to be modified to invoke public methods in the applet which in turn invoked Batik methods to manipulate the DOM where required.




From: John C. Turnbull [mailto:ozemale@ozemail.com.au]
Sent: Monday, 9 March 2009 20:13
To: batik-users@xmlgraphics.apache.org
Subject: Browser-based scripting in Batik applets - conclusions


I posted some time ago about my intentions to try using the JavaScript engine within a web browser to execute scripts in a Batik applet instead of the default Rhino environment.  I can now report that I have managed to get this kind of scripting working using a continuous animation script and the results are, as expected, unspectacular.


With Firefox 3.0.7 the scripts run a little faster than they do with Rhino but with Chrome they run significantly slower (so much for V8).  With IE 7 and Safari they run about the same speed as Rhino.  On Opera I haven’t been able to get the scripting to work and I don’t have the time to put any more effort into that.  I haven’t tried any other browsers.


So overall there is no compelling reason to use this technology other than that it enables smaller applet sizes because of the omission of the Rhino JAR.  However, given that internet speeds are increasing at a steady rate and that even with the Rhino JAR included the applet still downloads in an acceptable time frame, I don’t see this as significant.


I hope you find this information interesting.  This exercise has been beneficial in my enhancing understanding of Batik, scripting and applets so I don’t consider it a waste of resources.




John C. Turnbull