Reputation: 43
How do you open Windows Explorer (Windows+E) through Javascript?
Upvotes: 3
Views: 11113
Reputation: 36
Only way to achieve that is to register custom protocol handler in client's operating system. After that, any link related to that protocol would be sent to handler which would open desired application. In our case Windows Explorer.
Generally it supposed to work as "magnet:" links that are opening in BitTorrent clients. Or like "mailto:" links that are opening in Mail applications.
How to register protocol handler in Windows you can find here: Register Custom Handler @ Microsoft
But be careful, letting Windows Explorer to open links from the network without any filtering is not very safe. It's strongly recommended to write separate handler program that will process link, filter out all danger parts, and than pass ready link to the OS.
So after all you can make installation package that every client would have to install to make it work, and everything is great if that solution is for fellows from intranet, but not for strangers in Internet.
Upvotes: 0
Reputation: 477
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
Upvotes: 1
Reputation: 13820
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:/
.
Upvotes: 6