Subversion Repositories wimsdev

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2.     J.M. Evers
  3.     A check for browserversion.
  4.     A very small applet to be started before the WIMSchem applet.
  5.     Example:
  6.    
  7.     <applet id="CheckApplet" name="CheckApplet" data="WIMSchem/CheckVersion.class" archive="dist/WIMSchem.jar" width="1" height="1">
  8.     </applet>
  9.     <script language="javascript" type="text/javascript">
  10.         var VERSION_REQUIRED = 150;
  11.         var javaVersion;
  12.         try { javaVersion = document.getElementById("CheckApplet").getVersion(); alert(javaVersion);} catch(e){ javaVersion = 0;}
  13.         if( javaVersion < VERSION_REQUIRED ){
  14.             if(javaVersion==0){
  15.                 alert(" It seems your browser does not support Java - Javascript communication.\n Continue at own risk...");
  16.             }
  17.             else
  18.             {            
  19.                 var t=confirm("You must go to the java download page to get the latest JavaPlugin...\nMinimal Version :"+VERSION_REQUIRED);
  20.                 if(t){window.open("http://java.sun.com/javase/downloads/index.jsp","","status=1,toolbar=1,width=600,height=480");}
  21.             }
  22.         }      
  23.     </script>
  24. */
  25.  
  26. package WIMSchem;
  27. import java.applet.*;
  28.  
  29. public class CheckVersion extends Applet{
  30.     public void init(){}
  31.     public void stop(){}
  32.     public void destroy(){}
  33.     public String Version = System.getProperty("java.version");
  34.  
  35.     public String getVersion(){
  36.         String[] v=Version.split("\\.");
  37.         String version="";// 1.5.0_test123
  38.         for(int p=0;p<v.length;p++){
  39.             if(v[p].length() == 1 || v[p]!=null){
  40.                 version=version+""+v[p];
  41.             }
  42.         }
  43.         if(version.length()!=3){
  44.             if(version.length()==1){version=version+"00";}
  45.             if(version.length()==2){version=version+"0";}
  46.         }
  47.         return version;
  48.     }
  49. }
  50.  
  51.