DMM
asked on
Detect Java/ JavaScript
Hello,
I need to find out whether the user has enabled javasript/java or not. I need to have a hidden field in a form. I am able to do this for JavaScript but not Java.
can someone help me?
Thanks.
I need to find out whether the user has enabled javasript/java or not. I need to have a hidden field in a form. I am able to do this for JavaScript but not Java.
can someone help me?
Thanks.
Do you have access to ASP Pages?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The javaenabled property does not work in all browsers (not in IE3). And it won't work with browsers which have javascript turned off, and java turned on.
The best way is to have a small applet in your page that will redirect the browser to another page (it is quite easy to program such an applet). When the browser reaches that page, you know it is java-enabled.
Another way (but that does not work in IE3 and in all browser with javascript disabled, but java enabled) is to make use of the java-to-javascript communication possibilties. Using this you can change a form value in the current page if the applet is loaded.
I have made both applets mentioned.
The best way is to have a small applet in your page that will redirect the browser to another page (it is quite easy to program such an applet). When the browser reaches that page, you know it is java-enabled.
Another way (but that does not work in IE3 and in all browser with javascript disabled, but java enabled) is to make use of the java-to-javascript communication possibilties. Using this you can change a form value in the current page if the applet is loaded.
I have made both applets mentioned.
Good ideas.
If he thinks your answers are better then you can have the points.
If he thinks your answers are better then you can have the points.
ASKER
Hello All,
MasseyM, why do I need to have access to ASP pages? What do u mean by that?
sybe, As I said I need to pass a hidden field in my form which will tell me whether I have JAVA on or not. I am collecting info from the users. When they press submit, it executes a perl script -- this script also collects all the ifo from the form. I have used a dummy applet and given this field inside the applet. It seems to work in Netscpae but not in IE. Any help ?
rafistern, As sybe mentioned this will not work if JavaScript is turned off.
Thanks for all your help.
Regards,
MasseyM, why do I need to have access to ASP pages? What do u mean by that?
sybe, As I said I need to pass a hidden field in my form which will tell me whether I have JAVA on or not. I am collecting info from the users. When they press submit, it executes a perl script -- this script also collects all the ifo from the form. I have used a dummy applet and given this field inside the applet. It seems to work in Netscpae but not in IE. Any help ?
rafistern, As sybe mentioned this will not work if JavaScript is turned off.
Thanks for all your help.
Regards,
How about a dummy applet that writes a file on your server which is then read by the cgi script?
ASKER
Hello,
Can you give me an example please?
Thanks.
Can you give me an example please?
Thanks.
I can't write you the code as that would take me too long.. :-(
However the idea is this:
Have an applet which opens a socket and writes over it a file named for example with the IP address of the client. The cgi script looks for this file, notes its existance and promptly deletes it so that your server will not become cluttered with files.
This should work because an applet can write to the server from which it was called. The only problem may be erasing the file which I have had trouble doing in a cgi script (it depends on the permissions set for the directory).
If you want someone to suggest code then ask on the Java forum. I am sure that someone there could write the code in his sleep and wouldn't mind giving you a suggestion ;-) .
However the idea is this:
Have an applet which opens a socket and writes over it a file named for example with the IP address of the client. The cgi script looks for this file, notes its existance and promptly deletes it so that your server will not become cluttered with files.
This should work because an applet can write to the server from which it was called. The only problem may be erasing the file which I have had trouble doing in a cgi script (it depends on the permissions set for the directory).
If you want someone to suggest code then ask on the Java forum. I am sure that someone there could write the code in his sleep and wouldn't mind giving you a suggestion ;-) .
Anything between it and it's closing tag will only be displayed if javascript is disabled or not available. But that would only be a way to instruct the users that it must be enabled. As far as Java goes I have no idea.
You might want to post a question about java in the java section.
-Josh