How can I open a Windows Explorer window from Javascript?

可紊 提交于 2019-12-12 16:01:15

问题


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?


回答1:


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.




回答2:


window.open("file:///" + yourLocalOrNetworkPath);



来源:https://stackoverflow.com/questions/14119642/how-can-i-open-a-windows-explorer-window-from-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!