Open Explorer window from Website

我与影子孤独终老i 提交于 2020-01-21 05:25:07

问题


My company has a shared network folder for projects. This folder contains a sub-folder for each of our clients. Each sub-folder contains all the information for the projects done for those clients. Makes sense, yea?

OK.

I have been given a task: When in our company's MS CRM and viewing a client account, allow the user to click a button that will open explorer to the project folder for that account.

Sounds easy.

Did a bit of hunting online. This looks nice: http://blogs.msdn.com/crm/archive/2007/04/18/integrating-windows-explorer-files-and-folders-into-crm-tabs.aspx

It's funky, but it goes waaay beyond the scope of the task I've actually been given. However, my company doesn't use SharePoint (though we have licenses if we need it) and I don't have the time to invest tweaking this solution until it fits our CRM. I just need to open explorer on the client machine and point it at a folder. I want a button that will open explorer. Should be easy! I just want to set up a button in CRM, execute the command to open explorer /root, //server/projects/account, and then move on to more important things.

That said, I don't think like a hacker, so I didn't realize that this was an obvious security exploit that will be blocked most (if not all) of the time. So I gave it a go, but I've been having trouble opening explorer with JavaScript, which I thought would be the quick, easy and painless solution (duh me!)

Is there an easier way to do this than the example I cited above?


回答1:


Actually if you direct Internet Explorer to a local protocol, network shared folder or ftp server it turns to a file browser. This is automatic and you dont need to do anything other than making the folder you talk about to a network shared folder (via SMB) or FTP server. Just open that address in a new window:

window.open("file://\\192.168.1.10\clients\112");

window.open("ftp://192.168.1.10/clients/112");

either one should work




回答2:


You just need five slashes. I just tested this in Windows Explorer, Firefox and Chrome and (surprisingly) it worked on all browsers. Try:

<a href="file://///192.168.1.10\clients\112">Click me</a>


来源:https://stackoverflow.com/questions/1431112/open-explorer-window-from-website

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