How can I open a Windows Explorer window from Javascript?

Alihamra picture Alihamra · Jan 2, 2013 · Viewed 49.3k times · Source

I own a local PHP point of Sale, using wampp as my web-server (Win7). What I'm looking for is to find a way to open the Flash Drive E as we normally do by visiting My Computer - > USB Flash E: ... but using Javascript.

I have found this code, which works perfectly as needed...But this only works on IE, I'm using Google chrome as my POS browser but what chrome does..Opens up a blank window !

Here is the code :

<script>
function CallMe()
{
 window.open("file://PCNAME/E$");
}
</script>
<html>
<input  type="button" onClick="CallMe()" value="Open USB" />
</html>

Is there an alternative way to open USB Drive E? Maybe by using PHP?

Answer

Brian Ustas picture Brian Ustas · Jan 2, 2013

You could allow the user to navigate their filesystem from the browser using:

<input type="file" />​

You can't specify a default location nor can the browser open it automatically, however.