/    Sign up×
Community /Pin to ProfileBookmark

Javascript to detect Java install.

Hi All,
Does anyone know of were I might find a javascript that will detect whether the viewer has Java installed and active, then if not possibly pop up a message box telling them so and give advice on where to get it??
Thanks
E ?

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@JPnycJan 13.2005 — if (java.installed)

would be the test, I believe. You should be able to take it from there. Give em a link to sun microsystems if that test returns false.
Copy linkTweet thisAlerts:
@Khalid_AliJan 13.2005 — you can find out if java is enabled or disabled

alert(navigator.javaEnabled())
Copy linkTweet thisAlerts:
@age13kidJan 13.2005 — hello. i was reading your problem and i came across a soulution( if you havnt already found one ). this both detect if java is enabled and if javascript is not enabled with a <noscript> tag...

<i>
</i>&lt;html&gt;
&lt;head&gt;

<i> </i>&lt;title&gt;Untitled&lt;/title&gt;

&lt;/head&gt;

&lt;body&gt;
&lt;script language="Javascript" type="text/javascript"&gt;
if(!navigator.javaEnabled()){
alert('Enable your java to expirience this java enhanced page orn try install it...');
location.replace('http://java.sun.com');
}
else{
}
&lt;/script&gt;
&lt;noscript&gt;
Please enable javascript or get a new browser.
&lt;/noscript&gt; <br/>
yay you have both java AND javascript enabled! =)

&lt;/body&gt;
&lt;/html&gt;

of course you might want to change that around a bit but thats basicly it =)
Copy linkTweet thisAlerts:
@epocauthorJan 13.2005 — Hello and thank-you for your prompt replies. I guess I should have also explained my lack of knowledge of javascript. age13kid or anyone else, could you possibly explain how I might use the code you supplied to, if no java installed/enabled, another browser window may open with instructions. If Java installed/enabled, then nothing happens and the page continues to load the java applet.

Hope you can understand my explanation.

Thanks for ay futher input.

E
Copy linkTweet thisAlerts:
@JPnycJan 13.2005 — You'll 1st need to know if javascript is enabled. Build a page with no JS that says "Javascript and Java must be enabled to view this site". Then a JS redirect to the page with the JS function (if they have it enabled). There you can test for java, and redirect to sun if they don't. So you'll actually need 3 pages to do this right.
Copy linkTweet thisAlerts:
@age13kidJan 13.2005 — yup the code that i posted earlier will do the same thing by changing it around a bit...
<i>
</i>&lt;body&gt;
&lt;script language="Javascript" type="text/javascript"&gt;
if(!navigator.javaEnabled()){
alert('Enable your java to expeirience this java enhanced page orn try install it...');
location.replace('http://java.sun.com');
window.open('instructionsforintallingjava.html');
}
else{
document.write('&lt;applet watever&gt;&lt;/applet&gt;');
}
&lt;/script&gt;
&lt;noscript&gt;
Enabled javascript please
&lt;/noscript&gt;
&lt;/body&gt;

and JPnyc you really dont need all those webpages for testing to see if javascript and java is installed/enabled
Copy linkTweet thisAlerts:
@epocauthorJan 13.2005 — Thanks a heap for all your help. I think I am getting very close to what I need. Firstly, how do I disable Java for testing?? Secondly, here is my [URL=http://www.thedvdco.com/detect_java/vats.html]test page[/URL] I am unsure what needs to be done to get rid of the demo applet and have mine load on the ;[COLOR=blue]document.write('<applet watever></applet>');[/COLOR] Basically, what I want to happen is: if the viewer has Java, my panorama loads normally. If they don't have Java installed/enabled then the no_java.html page opens.

Thanks again

E
Copy linkTweet thisAlerts:
@jbotJan 13.2005 — [i]Originally posted by epoc [/i]

[B]Thanks a heap for all your help. I think I am getting very close to what I need. Firstly, how do I disable Java for testing?? [/B][/QUOTE]


this will vary from browser to browser. so, er ... use some commonsense and look up the online help for that browser. :rolleyes:



[i]Originally posted by epoc [/i]

[B]I am unsure what needs to be done to get rid of the demo applet and have mine load on the ;[COLOR=blue]document.write('<applet watever></applet>');[/COLOR] [/B][/QUOTE]


don't use the applet tag, it's deprecated, which means if you use certain doctypes within your webpage it will fail completely. instead follow [URL=http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/using_tags.html]SUN's advice[/URL].

good luck ?
×

Success!

Help @epoc spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...