我正在尝试通过使用 JS 的浏览器打开常规的 Windows 资源管理器。
<html>
<script>
function myFunction()
{
var thePath = 'C:\\Windows';
window.open('file://' + thePath, 'explorer');
}
</script>
<button type="button" onclick="myFunction()">Try it</button>
</html>
不断地写 Error: Access to 'file:///C:/Windows' from script denied
。脚本从完成的站点打开。
仅由 Windows 7/10 上的 IE 使用。您需要打开一个文件夹和/或文件。
实际上,如何使这个脚本工作?
对于 IE,您可以使用它
ActiveX
来启动*.exe
或打开文件夹。您可能需要允许Internet Explorer运行。
ActiveX