Determine whether client browser has java installed and can launch applets

前端 未结 4 944
一向
一向 2020-12-06 08:05

I am developing an .aspx page which will ultimately launch an applet after the user clicks on a button (I am using the tag). So, I would like to
4条回答
  •  离开以前
    2020-12-06 08:17

    Make in your applet a method

    public boolean isRunning() { return true; }
    

    Now create an applet:

    
    
    
    

    And now wrap this code in some helper function

    try {
      var x = document.getElementById('someId').isRunning()
      return x;
    } catch(e) {
      return false;
    }
    

    Why this works? If applet runs it will return true. If applet doesn't run or Java is not supported you'll get an exception, so you'll get false.

    提交回复
    热议问题