Link to home
Start Free TrialLog in
Avatar of jbreg
jbreg

asked on

Java Detect Not Working on Mac Firefox, Opera, Netscape

We have a website that uses a java-based map. We do a detect to see if java is installed before displaying the java map. If it is not installed, we display a static map. We use the following

function isJavaMap() {
 return ((navigator.javaEnabled()) && (GetCookie("maptype") != "image"))
}

It works on Windows IE, Nestcape, Opera, Firefox.

However, it does NOT work on Mac Firefox or Opera.

I have no idea why this is happening...can someone suggest an alternate java detection function that will work on all browsers.
Avatar of aozarov
aozarov

What does not work, navigator.javaEnabled() or GetCookie("maptype") != "image"?
Can you display the returned value from  both  navigator.javaEnabled()  and GetCookie("maptype")?
This site: http://www.skyzyx.com/scripts/java.php has a script (that basically detect java anbled in a similar way, but also adds the version) which works on Mac.
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Every other method we have looked at fails on some platforms.
Avatar of jbreg

ASKER

Aoz, navigator.javaenabled returns false even when java is installed and enabled on Mac Firefox, etc.

Objects, do you have any sample code--or references for this method--seems reasonable to me. Our requirements are simply to detect whether any version of Java (msft or sun) is installed. Can you be more specific about the object method?

In the <object> tag you specify a clsid for the version required, or you can request any version.
That'll check only for Sun's VM though.

The <applet> tag will check if a VM is present, and display alternate HTML if not.

What action did you want to take if no VM is available.
Avatar of jbreg

ASKER

I want to refer users to an alternate page which gives instructions on how to install java, and gives the option to proceed to the static map. However, the problem still remains that our detection does not work properly on all platforms.

Do you have an actual sample or example of a detect that will work across all (or more than we have currently) browsers??
I don't have a live reference site at the moment, let me see what I can dig up for you.

or something to try would be to put an <object> tag in the noappet portion of the applet tag as the object tag supports redirecting or promping the user if no VM is installed.
Avatar of jbreg

ASKER

Do you have an example of the load an applet that calls javascript once loaded method?
No not live, but the following shows how to call javascript from your applet

http://www.apl.jhu.edu/~hall/java/JavaScript-from-Java.html

Though from the sounds of your requirements the <object> tag would handle it just fine without the need for an applet to test the version.
Avatar of jbreg

ASKER

That page only lists scripts compatible with certain browsers.

The best option I agree is to have a javascript function that calls an applet to load. If it does not load, then the function returns false. Anyone know of examples of a) the script and b) the applet???
> That page only lists scripts compatible with certain browsers.

It shows how to call javascript from Java which is what you need to do.

> Anyone know of examples of a) the script and b) the applet???

If the browser doesn't support Java->JS comms then it aint going to work regardless.

Did you try using the object tag?
Avatar of jbreg

ASKER

We eventually solved this using object's solution, which is to call an applet that basically does the following:

If it executes, it redirects the user to a page.

If the user times out, meaning it does not execute, we redirect to a diferent, no java page.

It's been foolproof.