Mombu the Programming Forum

Mombu the Programming Forum > Programming > Detecting java not working for browser other than IE
REGISTER NOW! Search Today's Posts Mark Forums Read




Reply
 
Thread Tools Search this Thread Display Modes
1 17th May 22:54
lionel van den berg
External User
 
Posts: 1
Default Detecting java not working for browser other than IE



Hi all,

I've take some code from Sun and tried to adapt but it's not working. The
code is included below. It works for IE (separate flow) but it's not
working for Firefox 2.0.X or Konquror. I've been putting in alerts to
debug but this causes the behaviour to be different depending on where I
put them.

This is my first use of javascript. Any help appreciated.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>TCIWorks - Target Concentration Intervention Software</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<META NAME=DESCRIPTION CONTENT="">
<META NAME=KEYWORDS CONTENT=""">
<link href="css/tci.css" rel="stylesheet" type="text/css">
</head>

<body>


<div id="c">

<SCRIPT language="javascript">
var detect = navigator.userAgent.toLowerCase();
var windowsIE = (checkPlatform("msie") && checkPlatform("win"));
var launchTID;
function launchApp() {
if (windowsIE) {
document.write("<OBJECT CODEBASE=http://java.sun.com/
update/1.5.0/jinstall-1_5_0_05-windows-i586.cab
CLASSID=clsid:5852F5ED-8BF4-11D4-A245-0080C6F74284 HEIGHT=0 WIDTH=0>");
document.write("<PARAM NAME=app VALUE=http://
www.tciworks.info/JWS/index.jnlp>");
document.write("<PARAM NAME=back VALUE=false>");
document.write("</OBJECT>");

} else {
if (navigator.mimeTypes && navigator.mimeTypes.length) {

if (!webstartVersionCheck("1.5")) {
// Java Web Start not installed; open browser
window to install site
window.open("http://jdl.sun.com/webapps/getjava/
BrowserRedirect?locale=en&host=java.com",
"needdownload");
}

// Spin quietly, waiting to launch the app from the
original window
launchTID = setInterval("launchJNLP()", 100);
}
}
}
function webstartVersionCheck(versionString) {
navigator.plugins.refresh(true);

// First, determine if Webstart is available
if (navigator.mimeTypes['application/x-java-jnlp-file']) {
// Next, check for appropriate version family
for (var i = 0; i < navigator.mimeTypes.length; ++i) {
pluginType = navigator.mimeTypes[i].type;

if (pluginType == "application/x-java-applet;version="
+ versionString) {

return true;
}
}
}
return false;
}

function launchJNLP() {
if (webstartVersionCheck("1.5")) {
clearInterval(launchTID);
window.location = "http://www.tciworks.info/JWS/
index.jnlp";
}
}
function checkPlatform(string) {
place = detect.indexOf(string) + 1;
thestring = string;
return place;
}
</SCRIPT>


<INPUT onclick="launchApp()" type="submit" value="Launch TCIWorks"
alt="Launch">

<!--a href="http://www.tciworks.info/JWS/index.jnlp"
target="_blank">Launch TCIWorks</a-->
</div>

</body>
</html>
  Reply With Quote
SPONSORED LINKS BY GOOGLE

 


2 17th May 22:54
lionel van den berg
External User
 
Posts: 1
Default Detecting java not working for browser other than IE



I missed out a very important detail. The provided script works when Java
is NOT installed, but it doesn't work when it is installed.

Cheers

Lionel.
  Reply With Quote
3 17th May 22:54
andrew thompson
External User
 
Posts: 1
Default Detecting java not working for browser other than IE


What code? deployJava.js?


That never bodes well, especially when coming from
a (primarily?) Java programmer who adds..


My recommendation qould be to use deployJava.js
directly (hotlinked, as they suggest) off Sun's site.

If *that* script does not work, there would be a lot
more interest in fixing it.

And as an aside, comp.lang.javascript is probably
a better (more traffic) group than this one.

--
Andrew T.
PhySci.org
  Reply With Quote
SPONSORED LINKS BY GOOGLE

 


4 21st August 01:43
lionel van den berg
External User
 
Posts: 1
Default Detecting java not working for browser other than IE


Naturally the one linked from the JWS documentation.

http://java.sun.com/developer/techni.../javawebstart/
AutoInstall.html

But the site is a maze.


I apologise for not being an immediate expert. I'm not sure what else you
expected me to do!

deployJava.js worked perfectly. Very simple. Thanks, problem solved.

My bad. second time I've done that. It pops up right at the top of the
search in the newsreader and looks good so I click subscribe and fire
away.

Thanks

Lionel.
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes







Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
Also visit Ogoun the Usenet Archive
666