运行外部vbs文件,在js函数中

Run external vbs file, in js function

本文关键字:js 函数 外部 vbs 文件 运行      更新时间:2023-09-26

我需要的是,在浏览器检查完成后,如果是IE, js函数将调用。vbs文件,然后运行它…我在谷歌上搜索了一段时间,但没有找到有助于解决这个案子的东西……有人能给我点建议吗?

这是实际的脚本:
<script>
function verify(){
    var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
    if(!is_chrome)
    {
        var retVal = confirm("run vbs to proceed");
        if( retVal == true ){
      alert("User wants to continue!");
      return true;
        }else{
      alert("User does not want to continue!");
      return false;}
    }  
    else
    {
        window.location.href = "destination.html";
    }
}
</script>
</head>
<body>
<a onclick="verify()">Link</a>
</body>
</html>

创建wshshell.run来运行。为了避免安全问题,您必须导航到本地html页面。