如何从 Javascript 打开 Windows 资源管理器窗口? [英] How can I open a Windows Explorer window from Javascript?
问题描述
我拥有一个本地 PHP 销售点,使用 wampp 作为我的网络服务器 (Win7).我正在寻找的是找到一种方法来打开闪存驱动器 E,就像我们通常通过访问我的电脑"-> USB 闪存 E:...但使用 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.
我找到了这段代码,它可以根据需要完美运行……但这仅适用于 IE,我使用 Google chrome 作为我的 POS 浏览器,但 chrome 的作用是什么……打开一个空白窗口!
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 !
代码如下:
<script>
function CallMe()
{
window.open("file://PCNAME/E$");
}
</script>
<html>
<input type="button" onClick="CallMe()" value="Open USB" />
</html>
有没有其他方法可以打开 U 盘 E?也许通过使用PHP?
Is there an alternative way to open USB Drive E? Maybe by using PHP?
推荐答案
您可以允许用户使用以下方法从浏览器导航他们的文件系统:
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.
这篇关于如何从 Javascript 打开 Windows 资源管理器窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!