Java版本和安装检查不起作用

时间:2013-08-27 02:39:21

标签: java javascript jsp java-web-start

我在网页中使用javascript来检查计算机上是否安装了java和java web start。就像这个

      var javawsInstalled = 0;
      var javaws150Installed = 0;
      isIE = "false";

      if (navigator.mimeTypes && navigator.mimeTypes.length) {
         x = navigator.mimeTypes['application/x-java-jnlp-file'];
         if (x){
            javawsInstalled = 1;
            javaws150Installed = 1;
         } 
      } else {
         isIE = "true";
      }
      console.log("javawsInstalled: " + javawsInstalled)
      console.log("javaws150Installed: "+ javaws150Installed)
      console.log("is IE" + isIE)

之前有代码

<SCRIPT language=VBScript>
          on error resume next
          If isIE = "true" Then
            If Not(IsObject(CreateObject("JavaWebStart.IsInstalled"))) Then
                  javawsInstalled = 0
            Else
                  javawsInstalled = 1
            End If

            If Not(IsObject(CreateObject("JavaWebStart.isInstalled.1.6.0.0"))) Then
                  javaws150Installed = 0
            Else
                  javaws150Installed = 1
            End If  
          End If
</SCRIPT> 

然而,它似乎并不适用于所有浏览器和所有Java版本,例如,当安装Java 7更新15时,它将在控制台中显示以下内容。

javawsInstalled: 0 index_cn.jsp:27
javaws150Installed: 0 index_cn.jsp:28
is IEfalse 

0 个答案:

没有答案