问题
Possible Duplicate:
Determine whether client browser has java installed and can launch applets
I would like to run a check to see whether Java is not installed or if it's disabled / blocked in IE.
I have tried navigator.javaEnabled() and this works as expected in Firefox (v10.0.2), but in IE8 it returns TRUE. However, IE displays a prompt to the user:
The page you are viewing uses Java.
More information on Java support is available from the Microsoft website.
The issue I have with this is, there is a checkbox "Do not show this message again"
that can obviously be ticked and then there would no longer be any prompt to the user that Java is not enabled.
How can I handle lack of Java support in IE?
回答1:
From this link:
navigator.javaEnabled() does not reveal whether Java is installed or not in IE. It merely tells you if the applet tag is enabled or disabled.
You can disable the applet tag in the IE security settings … Tools -> Internet Options -> Security -> Custom Level -> Java Permissions -> Disable Java
This will cause javaEnabled() to be false, yet Java is still installed. For that matter, it isn’t disabled either. Only the applet tag is disabled.
And from the same link:
The JRE (formerly Java Virtual Machine, or JVM) is actually more difficult to handle than you would think. Determining if Java is installed is easy—a quick call to navigator.javaEnabled() returns a simple Boolean.* The problem is detecting the version and provider (Microsoft or Sun).
I never found a satisfactory solution to this. The gist is this: to get this information, you must load a Java applet.
Here's another example:
Determine whether client browser has java installed and can launch applets
来源:https://stackoverflow.com/questions/9569795/how-to-detect-if-java-is-enabled-in-ie