How do you open Windows Explorer (Windows+E) through Javascript?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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:/
.
回答2:
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
<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