The JavaScript interpreter in most browsers is very isolated from the PC
for security reasons. However, that is getting better:
And those limitations can be removed or avoided by installing extra software
into the computer. This can be a somewhat automated process where the user
simply approves the installation and it is downloaded and installed. Security
is only circumvented with the express approval of the user.
There are two basic means of doing this:
-
Plug-ins: Software installed into the browser and system which allows
direct communication between the JavaScript engine in the browser and the
port. There are commercial Active-X controls for Internet Explorer and Java
programs for other browsers. (see below)
-
Services: A separate web listening service (like a web server) installed
on the PC with the serial port, with which the JavaScript can communicate
via TCP/IP. This service then translates between TCP/IP and the serial port.
Or you can avoid the browser issue by running outside the browser:
-
http://phonegap.com/ Actually converts
web apps into native phone apps. Allows access to some phone hardware such
as geolocation, accelerometers, and compass.
-
Although it is NOT actually HTML5 app development,
DroidScript: JavaScript Language App
does allow a lot of the same features and full access to phone hardware.
-
Dexter Development Environment (DDE)
https://github.com/cfry/dde allows
JavaScript development in an Electron Application:
Introduction
to Automation: Living beyond yourself.
Web pages, HTML, Javascript and the Internet Of Things (IOT)
(A Google drive
collaborative
presentation)
See also:
HTML5 Web Apps.