Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I open a Windows Explorer window from JavaScript?

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?

like image 872
Alihamra Avatar asked Jun 11 '26 09:06

Alihamra


1 Answers

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.

like image 91
Brian Ustas Avatar answered Jun 14 '26 01:06

Brian Ustas