Is there a simplistic solution to obtain the version of Java running on a user’s workstation using php? Basically I want to know the version of Java running on a user’s machine who accesses my portal. This data will help me make some policy decisions later since our product is Java based.
Share
The only client side languages which have (in)direct access to both client side (to determine the information) and server side (to send the information) are JavaScript and ActionScript.
I think you’re as being a PHP programmer already less or more familiar with JavaScript, so I would go ahead with that. Fortunately Sun already offers the Java Deployment Toolkit JavaScript library exactly for those needs. Here’s an SSCCE, just copy’n’paste’n’run it:
Once having the information, just send it to the server side. You can do that either synchronously by passing it as a hidden input element of a form, or asynchronously using Ajaxical techniques. jQuery is perfectly suitable for this. Just do a
$.get('script.php?java=' + deployJava.getJREs());or so.