JavaScript/JQuery communicate with SerialPort/COM1
Solution 1
Yes you can, but not with a typical browser. Browsers are sandboxed to not have access to the local file system (except cookies) so that malicious sites can't read from / write to your hard drive. As far as I know there is no way to override this behvior (short of writing your own browser).
However, this can be done in JavaScript using Node.js. It runs as a process rather than in a browser window and can access the file system. Specifically, there is already an npm module (node library) for serial communication: https://github.com/voodootikigod/node-serialport
Alternatively, you could always just spin up a local web server (via node.js, php, rails, etc). Web servers can access file systems, and therefore should be able to access serial ports.
Hope this helps.
Solution 2
I think it is possible..
Look to: jUART, Cross platform browser plugin for serial port communication from JavaScript https://github.com/billhsu/jUART
Solution 3
with chrome it's possible ,
here is the link for documentations : https://developer.chrome.com/apps/app_serial
or
Solution 4
kimstik's suggestion, using the jUART plugin for the browser is an excellent solution.
Another possibility is to use a middleware, that facilitates the serial communication and provides a web interface, that JavaScript can interface with using AJAX requests.
Python could be used, e.g. a script using a combination of pySerial and python-bobo.
Alex Tape
i am a student of information science and information management focused on applied computer science pieces of wisdom: mathmatics is the language of nature everything around us can be represented and understood through numbers if you graph these numbers, of any system, patterns emerge there are patterns - everywhere in nature!
Updated on July 09, 2022Comments
-
Alex Tape almost 2 years
is it possible to force any communication from e.g. Javascript/JQuery to any serial comport?!
google is not able to answer that question.. but anyway it should be possible.. env is firefox in my case..
ideas/knowledge is very welcome.
kindly tape
-
nerdwaller over 8 yearsUpdate on this: Sept 15, 2015 Chrome will no longer support the NPAPI and the solution will Likely no longer work. see here
-
JIntro almost 7 yearsChrome has moved away from supporting Chrome apps in anything other than ChromeOS according to this blog post.