How to open Windows Explorer (Windows+E) using Jav

2019-07-03 05:08发布

问题:

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