Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
vitaly  
#1 Posted : Friday, August 9, 2013 2:28:58 AM(UTC)
vitaly

Rank: Advanced Member

Groups: Member
Joined: 12/19/2012(UTC)
Posts: 164

Was thanked: 8 time(s) in 8 post(s)
Problem

There are many different versions of Java, and to be sure, that your end users will have no problems with the Java Uploader, it is necessary to verify the Java version actually installed (and whether it is installed at all). This article describes how you can do it using JavaScript.

Solution

Oracle created a Deployment Toolkit Script to make it possible to check what Java versions are installed on the machine. This is a simple .js file which you link to your HTML page and after that you can receive information about Java version through the special JavaScript functions.

You can find Deployment Toolkit Script and its detailed description on this page:

http://docs.oracle.com/j..._advice.html#deplToolkit

Let’s see how we implement Java verification on your site.

There are three options available:

1. No Java installed. In this case, we should send the user to the Test Java page (http://www.java.com/en/download/testjava.jsp) where the user will see all necessary instructions how to install it.

2. Outdated version of Java installed. In this case, we should send the user to the Verify Java Version page (http://java.com/en/download/installed.jsp). On this page the user can update the Java to the latest version.

3. The latest version of Java installed. In this case, we can be sure that our Java applet will work as expected and display it on the page.

We will use two methods of the Deployment Toolkit Script:

• deployJava.versionCheck() - to check if the specified Java version is installed.

• deployJava.getJREs() – to check if any Java is installed (in this case, the method will return an empty array).

This code example illustrates how to display the Java uploader or an appropriate link to www.java.com depending on the Java plug-in status:

Code:
<script type="text/javascript" src="http://java.com/js/deployJava.js"></script>
<script type="text/javascript" src="Scripts/aurigma.uploader.js"></script> 
<script type="text/javascript"> 
    var javaVersion = "1.7.0_25"; 
if(deployJava.versionCheck(javaVersion) || deployJava.getBrowser() == "MSIE") { 
var u = $au.uploader({
    id: 'Uploader1'    
    // configure ActiveX/Java Uploader        
});

u.writeHtml(); 
} else { 

if (deployJava.getJREs().length == 0){
document.write("There are no JREs detected on your machine. Go to <a href='http://www.java.com/en/download/testjava.jsp'>test java</a> page. Install Java and come back.");
} else {
document.write("You have too old Java version. Please go to <a href='http://java.com/en/download/installed.jsp'>verify java</a> page, update your Java and come back.");
}   
} 
</script>

Note: Don’t forget to download the http://java.com/js/deployJava.js and link it to the HTML page!

Edited by moderator Monday, August 29, 2016 6:37:33 AM(UTC)  | Reason: Not specified

Best regards,

Vitaly Kustov

Aurigma Technical Support

Andrew  
#2 Posted : Friday, November 8, 2013 2:15:03 AM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
It turns out that Oracle embeds a special Java plugin to check the version and Firefox does not like this plugin. That's why it says that they block it and may display a text block on the page saying that it is get blocked.

So it looks like this method to detect installed Java is not so good. The workaround would be to hide this applet:

Code:
$(document).ready(function () {
    $("#deployJavaPlugin").hide();
});

But Firefox will still display a warning (red lego block on the top of the browser window).

When we figure out how to do it without deployJava, I will keep you posted.

Andrew  
#3 Posted : Thursday, November 14, 2013 10:38:25 PM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 876

Thanks: 2 times
Was thanked: 27 time(s) in 27 post(s)
Important update: you can get the Java version through the uploader applet, without any deployJava.js. Just use the getJreVersion, like this:

Code:
document.getElementById('Uploader1').getJreVersion();
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.