如何使用 Javascript 打开 Windows 资源管理器 (Windows+E)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5587857/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to open Windows Explorer (Windows+E) using Javascript
提问by Keitherj
How do you open Windows Explorer (Windows+E) through Javascript?
如何通过Javascript打开Windows资源管理器(Windows+E)?
回答by Devin Burke
You cannot open Windows Explorer through JavaScript because modern web browsers are locked down to offer virtually zero access to the client user's hard drive. An unpatched version of Internet Explorer 6.0 could have accessed Windows Explorer by browsing in a new window to file://c:/
.
您无法通过 JavaScript 打开 Windows 资源管理器,因为现代 Web 浏览器被锁定以提供对客户端用户硬盘驱动器的几乎零访问。未打补丁的 Internet Explorer 6.0 版本可以通过在新窗口中浏览到file://c:/
.
回答by Rajesh Kumar Bhawsar
window.open wont work for local path or network path on modern browsers, you need to turn your path to URL like c:\data to file:///C:/Data/ or you can use HTML5 feature like below
window.open 不适用于现代浏览器上的本地路径或网络路径,您需要将路径转换为像 c:\data 这样的 URL 到 file:///C:/Data/ 或者您可以使用如下所示的 HTML5 功能
<pre>
input type="file" name="itemImagePath"
</pre>
Another way to open folder in web browser is:
在网络浏览器中打开文件夹的另一种方法是:
<pre>
<a href="\mypc\c:\myfolder">Open folder</a>
</pre>
mypc: your computer name myfolder: folder you want to open
mypc:您的计算机名称 myfolder:您要打开的文件夹