【问题标题】:I can't open an exe using Javascript我无法使用 Javascript 打开 exe
【发布时间】:2014-06-27 11:14:52
【问题描述】:

我只想使用 html Js 打开一个 notepade.exe,我尝试了这段代码,但它不起作用任何人都可以帮助我解决这个问题。这个文件是run.html !!!

<html>
  <head>
   <script>
    alert("hi");
    <!-- myWindow.close();   -->
    var param1var = window.location.search.replace( "?", "" );
    alert(param1var);
    var oShell = new ActiveXObject("Shell.Application");
    var commandtoRun = "C:\\Windows\\notepad.exe"; 
    oShell.ShellExecute(commandtoRun,"","","open","1");
    window.close()
   </script>
  </head>
</html>

【问题讨论】:

  • 定义“它不工作”。怎么了?你有错误吗?
  • 我刚刚使用了记事本,可以在控制台中看到错误提示“未捕获的 ReferenceError:ActiveXObject 未定义”
  • @VigneshMarteen 您是否尝试在 Internet Explorer 中运行此代码? ActiveXObject 只能在 IE 中使用。
  • 嗨 Dean.DePue,我尝试了相同的链接并将输出复制并粘贴到此处。即使它没有运行。

标签: javascript html asp-classic activex


【解决方案1】:

打开 Internet Explorer 并更改/启用这两个设置

Tools &gt; Internet Options &gt; Security &gt; Custom level &gt; ActiveX Controls and plug-ins &gt; Initialize and script ActiveX controls not marked as safe for scripting

Tools &gt; Internet Options &gt; Advanced &gt; Security &gt; Allow Active Content to run in files on My Computer

以防万一,重启 Internet Explorer

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-15
    • 2019-11-18
    • 1970-01-01
    • 2018-07-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多