javaDeploy.js

Hey All,

Am new to this forum, recently discovered you guys after I was googling a problem - definitely a fantastic resource here.

I have given this forum a good search looking for peoples thoughts/views on the javaDeploy.js mechanism for embedding applets into a webpage. I followed Sun/Oracles procedure for using this method of deployment for my game and it threw up some interesting results. Namely that the applet tag generated by the javascript is infact incomplete, as in there is no closing tag - This then has a knock effect of people using a browser/OS combo of Safari/Mac OSX having the inability to start the applet. I was also interested to see that the javascript never generated an object tag despite W3C saying it is the preferred tag for applets and that applet is infact deprecated.

One thing I did glean from these forums is that alot of people still use the applet tag. So I was thinking, is this route generally preferred over the javascript? Why does no one (Including Oracle/Sun) use the object tag? I have also notice quite a few recommendations on parameters to pass into the applet, is there a definitive selection people now use as standard?

Would really like to hear some thoughts on this.

Cookie

Good question. It’s basically a mess. There’s not just a variety of tags to use, you can also use a jnlp file to make an applet too. I don’t think anyone uses that javascript deployment script. It was basically a complex way to detect if java exists and if it does, what version is available. Most of us just use the APPLET tag and hope that java is installed and if not then keep our fingers crossed that the user’s browser tells them so, which most browsers do.

By the way I tried to figure out applets a little while ago and got very frustrated. Here’s a thread which detailed my troubles and solution:

http://www.java-gaming.org/index.php/topic,23716.0.html

There’s a wealth of expertise on Applet deployment here, especially kappa and the other LWJGL devs who figured out the excellent LWJGL applet launcher.

To intercept whatever javaDeploy.js is doing, I use this code:


var intercepted = ''; var documentWriteFunc = document.write;
document.write = function(arg){intercepted += arg;}
deployJava.runApplet(appletAttributes, appletParameters, '1.6');
document.write = documentWriteFunc;

Thanks for the info peeps. It’s a shame Sun/Oracle never nailed this…

In short, Sun/W3 depreciated the tag in favour of the tag. Surprisingly IE implemented it but for whatever reason Mozilla implemented the tag instead. However both browsers still supported the tag for backward compatibility reasons. Thus till this day the tag is the simplest way to use applets as it just works on all the browsers even though it was depreciated by Sun/W3.

Using JavaScript has its advantages as you can detect the browser and use it to automatically pick the appropriate tag for the applet. Further it has the advantage of being able to detect java (in most cases) and point you to the java.com site if missing or if its out of date.

However since the JavaScript route adds a bit of complexity to deployment many avoid it.

Using JavaScript can be very useful if you want to dynamically link html elements and applets, but unless you actually want to I’d use .