Continuous read of USB attached device using JavaScript? - javascript

Right now we have a Windows app that continuously reads a USB-attached scale and displays (and uses) the value.
Can I do this via a web page? Someone mentioned a "javascript input event listener", maybe? Does anyone have a simple HTML example?
thanks

I doubt you would be able to get information from hardware using a browser without using a java applet or something similar.
You could write a web interface that communicates with a process running on the machine, but you would not be able to access the hardware directly through the browser.
For more information regarding the protections surrounding browsers, look here:
http://www.australianscience.com.au/research/google/35779.pdf
My suggestion:
If you have a windows application but you want to run the interface in the browser, do something like VLC (http://www.howtogeek.com/117261/how-to-activate-vlcs-web-interface-control-vlc-from-a-browser-use-any-smartphone-as-a-remote/)

Related

Create an extension to the browser to acces local scanner

I would like to access a special hardware (a penta scanner, for the wisest ;) ) from a web page.
The aim is to retrieve the information from the scanner and compute it on server side.
The problem here, is that I have to summon functions from a DLL that has to be on the client side. I have two leads for that:
Develop a COM DLL and use ActiveX
Try to get through a homemade extension for a web browser in order to communicate with the local DLLs.
I've tried the first option, and I got stuck and I've posted another thread about it. Anyway, even if it works, there are too many constraints about it (as to use IE or the fact that even Microsoft is not fond of this feature and banned it from edge).
The second method is something that I found on another forum but, I do not understand how I can interact with a browser extension (whatever the browser).
So what I am asking is:
Is it possible to use a web browser extension as a medium to a local DLL and if so, would you be so kind as to give a hint about how to do ar anything that might look like a start about how to do it (even just some key words to use on google, since mine didn't get anything)....
Thanks.
Based on my understanding, the motive to develop an Extensions is to enhance the feature and functionality for particular web browser.
You cannot control any hardware devices like printer or scanner with it.
So if your goal is to control the scanner from your web page with the help of any kind of extension than I think you cannot do this with Extension.

Is there a way to check if Google Chrome is installed (and default browser) via web page / JavaScript without installing anything to client?

Is there a way to check if Google Chrome is installed (and default browser) via web page / JavaScript without installing anything to client PC?
Edit: Or is there something fancy using Flash?
Javascript can check what the current browser is.
Javascript can't check your filesystem without your permission.
I think it should be possible to check what browser are installed using some javascript/windows trickery. (how else can gpu-producers detect hardware online?)
No, that would be crazy. Typically javascript is constrained to knowing things about the current browser only, and a few basic things about the computer like the OS and screen dimensions. It would be a security concern if javascript could look through the programs and files on your cmputer.

IronJS / Twilio Browser Soft Phone

I'm creating a Fiddler extension that is simplifying my interaction with Twilio during development. I'm about to release it to the wild, but I would like one more feature before I do so.
I'm able to return the various phone numbers on my Twilio Account, and list them with the various URLS that are required.
I would like to select on of the numbers, and "Click-To-Test" whick will dial the selected phone number. I would then like to interact with my Twilio service via my computer rather than picking up a phone.. I should be able listen to the voice prompts, and interact by dialing 1, 2, 3 etc. when prompted.
Twilio offers this JavaScript library here (Twilio in the Browser), and give an example here via Azure (Twilio in Javascript Application), or here via MVC (Hello Monkey Client)
All of which leverage a Javascript library which creates a Twilio Device on the client side. I'm NOT a Javascript guy (yet, but it looks like that's next on my every growing learn-this-technology list), but I have to think that the same functionality could be implmented in C#.
I've attempted to host the device in a browser control, but I'm not getting to far with it, and the integration still remains on how to pass a select item in C# to a executing Java Script library running in a browser.
I've also looked into IronJS run the JavaScript via the Dynamic Run Time, but I'm not sure if that will work in the end. The Twilio Library looks for a script tag in the web page, and hooks up several event handlers. Running the library in IronJS, causes it to fail as there is no web page, and my Java chops are not up to hacking this piece out.
My question is: Can't this Javascript Library be ported to C#, and create a full client that Twilio sees like the Javascript soft phone? I would think this would not only be helpful for me, but also for Win 8 dev, and Windows Phone 8 Dev as well.
I'm not a C# developer, I believe hosting the JS library in a WebBrowser control seems the way to go (at least much easier than porting the library to C#).
According to MSDN, you can use the Document property to call JS code from your application. For example, if you had this defined in your web page:
function test(message) {
alert(message);
}
You can call it from your application:
webBrowser1.Document.InvokeScript("test",
new String[] { "called from client code" });
Unfortunately, there's not a straightforward path to using Twilio Client in Windows 8 or other Windows desktop apps. I will pass along this feedback that it would be great to have VoIP functionality through Twilio for Windows 8 apps.
The Twilio C# helper library should help with this.
https://github.com/twilio/twilio-csharp
See the blog post below for an example application:
http://www.twilio.com/blog/2012/02/twilio-for-net-developers-part-5-twilio-client-mvc-and-webmatrix-helper-libraries.html
You also linked earlier to a Twilio Client C# code example:
http://www.twilio.com/docs/quickstart/csharp/client/hello-monkey
All of the Twilio Quickstarts can be viewed in C# using the language drop down in the upper right.

Not allow any other application to open except a browser

I am presently working on website (Java EE). One of the requirements is to not let the client to open anything else other than the browser. After a lot of search I got the following results :
Change the policy of the OS.
Write some batch/c/c++ program which will intercept all the keyboard and mouse events not letting the user open anything else.
PS : It should work on windows and IE 7 or above only. The other OS and browsers need not be considered. This software is made only for intranet, so I already have control on the client machines if I have to run something.
My question is .. is there anything else I can do which will reduce the work needed on the client side or on the program which I have to write??
This is very OS specific I'd say. Windows, I believe, has APIs related to finding open windows. You could find all open windows and close them. In your application's main loop you can detect if any windows are open then close them.
Perhaps mac and ubuntu have something similar.
This might be a good place to start looking: http://msdn.microsoft.com/en-us/library/ms633497%28VS.85%29.aspx
I have no idea how to use it though.
You'll need something more powerful than javascript to communicate with your application that is monitoring the user's desktop. You may want to look at connecting JS to Silverlight then having the client download something upon opening the browser that is also similar to silverlight or .net. Then you can have them all communicate possibly.
You can set IE to be the shell process (a registry key) instead of explorer.exe, and then run IE in kiosk mode, and then disable task manager via policy (to prevent new processes).

Is accessing USB from a web application for cross browser cross OS possible at all?

I am wondering if there is a way we can achieve this. I heard different things about Silverlight 4, JavaScript or ActiveX control, but I have not seen any demo of code for any of them.
Is there a web component that is available or how can I write one?
We really like to capture a client's USB drive via the Web and read/write data on it. This has to work for any operating system in any web browser.
What about WPF in browser mode? I read that I can host my WPF applications inside browser and sort of like smart client.
Here is a great example of doing this via Silverlight 4, but the author mentions about possibility of accessing USB on Mac via:
Enable executing AppleScript scripts.
This option will let us have the same amount of control on a Mac machine as we do on a Windows machine.
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 Microsoft Office automation. For any other operating system feature, you’ll have to code the OS access twice.
I did not quite understand it. Has any tried this?
Web browsers are deliberately isolated from the filesystem for security reasons. Only Java (not "Java Script"), Flash or browser plug-ins can accomplish this.
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.
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.
What about WPF in browser mode...I read that I can host my wpf apps inside browser and sort of like smart client.

Categories

Resources