Is Accessing USB from web application for cross browser cross os possible at all?

浪子不回头ぞ 提交于 2019-12-11 06:36:50

问题


I am wondering if there is anyway we can achieve this. I heard different things about Silverlight 4 , Java Script or Active X control but not seen any demo of code for any of them.

Does anyone know any web component that is available or how to write one.

We really like capture client's USB drive via Web and read/write data on it. This has to work for ANY Operating system in Any web browser.

Thanks

UPDATED

What about WPF in browser mode...I read that I can host my wpf apps inside browser and sort of like smart client.

Here is a great example of doing this via silverlight 4 but author mentions about possibility of accessing USB on MAC via

1) Enable executing AppleScripts. This option will let us have the same amount of control on a mac machine as we do on a windows machine.

2) Add an overload to ComAutomationFactory.CreateObject() that calls the “Tell Application” command under the scenes and gets a AppleScript object. This option would work extremely well for Office automation. For any other operating system feature, you’ll have to code OS access twice. 

I did not quite understand it. Has any tried this ?


回答1:


If you're willing to introduce a dependency on Flash (10), you can use the FileReference class to get access to one file at a time, first for reading using the browse method, then for writing using the save method.

Note that for security reasons, each call to these methods must be triggered as a result of user input (e.g. clicking a button), and each time they are called an OS-specific File Open/Save As dialog box is displayed.

There's a video tutorial which gives some sample code for editing a text file (load + save) directly in Flash, without needing any server-side help. It should be enough to get you started in the right direction.




回答2:


Web browsers are deliberately isolated from the filesystem for security reasons. Only Java (not "Java Script"), Flash or browser plug-ins can accomplish this.




回答3:


JavaScript cannot directly access your local disk (including a flash drive) for security reasons (would you really want any web site you look at to access, change, or even delete your files?), and ActiveX controls are IE-specific, so you should probably use a Java applet (not JavaScript). While Java's security policy normally does not allow access to local disks, signed applets can with the user's permission.




回答4:


What about WPF in browser mode...I read that I can host my wpf apps inside browser and sort of like smart client.



来源:https://stackoverflow.com/questions/4564973/is-accessing-usb-from-web-application-for-cross-browser-cross-os-possible-at-all

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