Method that detects whether an application is installed using JavaScript's ActiveXObject object

  • 2020-03-30 02:38:26
  • OfStack

The company's own internal procedures, by calling the external protocol to normal use, but the external protocol must cooperate with a client can be, so I want to judge whether the client is installed by js, if not installed, jump to the download address, similar to some online thunderbolt, express download link. After checking the method, the implementation method is as follows:


<script type="text/javascript">
function checkClient(obj){
   try{
       var a = new ActiveXObject("suncloud.app");
       obj.href = obj.path;
   }catch(e){
       alert(" Please install the client first ");
       obj.href="http://xxxx/client.zip";
   }
}
</script>
<a href="#" onclick="checkClient(this)" path="suncloud://QUFodHRwOi8vZG93bi5zYW5kYWkubmV0L1RodW5kZXI1Ljkg = = "> The connection </ a>

ActiveXObject is the information that the client software registers in the client registry. Detection thunderbolt fill in thunderagent. Agent or thunderagent. agent. 1


Related articles: