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
I think it is possible..
Look to: jUART, Cross platform browser plugin for serial port communication from JavaScript
https://github.com/billhsu/jUART
with chrome it's possible ,
here is the link for documentations :
https://developer.chrome.com/apps/app_serial
or
http://www.fabiobiondi.com/blog/2014/02/html5-chrome-packaged-apps-and-arduino-bidirectional-communication-via-serial/
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.
Update to this thread, if you are using chrome you may use Web Serial to communicate using web to serial port.
https://chromestatus.com/feature/6577673212002304
https://web.dev/serial/
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.
Related
Operating system : Windows 8.
Input-from : A text field from a html page .
Input-type: text.
Output : the file that was searched.
What I want : I want the user to enter some keywords and have JavaScript search the user's local files...
Is there any way? or A javascript Library?....
And how I can query the file system about the files using Javascript..in Windows..
EDIT::
Thanks everyone for the reply...
The way I get it is ,either I have to develop my own browser based in Java that has sufficient permissions.. or
I would have to implement a file crawler that indexes everything that sends that file to the a server , so that javascript can then access it through xmlhttp requests to the server ....
This was just a curiosity and I don't want to expose anyone's personal files on the Internet.
A fun project.. That all tinkered in my mind.
This is not possible from a web page because of the browser's security restrictions. You could access the local file system with Node.js or an Electron app, but I don't know if that would suit your use case
No. That's simply not possible and even if it is, it should not be used, as it would make one's local file system open to various threats because you are directly exposing your machine on the internet. That's sufficient enough reason for a webapp not to access one's local file system in any manner whatsoever.
P.S: If you really want it, There are a few third party libraries which use Sandboxed file systems. You can try that if you want.
I havent tried it personally, but found the below link via quick googling so i am not sure if its officially supported up until now.
https://www.html5rocks.com/en/tutorials/file/filesystem/
Use <input type="file">, which implements ability for user to select file from local filesystem.
I have a website hosted in ISS (can be other) that loads when it's called on localhost but not from extern :) like: http://:8081/Website.html.
The verification whether the website is called from localhost it's on the client in a js script that I can’t modify as it’s encrypted.
So I was thinking at two options:
Develop an ASP application that has a remote desktop connection to the machine that host the website (not some many example on how to).
Maybe configure the IIS configuration (didn't found how)
I'm out of ideas
Do you have any other solution or can you point on how can I do one of the above?
I have tried the WinForm solution from here: https://www.codeproject.com/kb/cs/remotedesktop_csharpnet.aspx and it doesn't work. And I prefer a website.
Updates:
The only working solution that I have for now is to configure a Remote Desktop Services (Web Access) as I hosted the application on Server 2008 R2. Then I only shared the browser that has the localhost page as default page
The javascript files are all minified and encrypted, meaning that if I search localhost as a word in all the files, nothing shows up. So fixing the client will be hard.
Is it possible to create a new Site Binding on IIS and access the site using the binding hostname? This requires your network DNS to register the hostname to the IP Address.
I assume you are dealing with encrypted(???) javascript that is hardcoded to display DOM only if it is loaded from localhost.
If by encrypted you mean minified you should still be able to find reference to "localhost" and modify javascript in minified version. If it is really encrypted by a wrapper of third party javascript library then I would suggest you to rewrite javascript. I mean how can there be any quality code in javascript code that is hardcoded to load only from localhost?
Fix the client and stop exploring other solutions like remote desktop connection. None of them are practical and sustainable solutions.
I think you need to use WebRTC, but it's supported for Chrome and Firefox. It allows two users to communicate directly, browser to browser using the RTCPeerConnection API.
I'd like you to give a tip for my issue. I'm pretty new to javascript so I don't have such overview.
I have a desktop application - it's basically a storega for data (+ some GUI). And there's a set of Javascript files, which are ment to get data from desktop application.
These javascript files runs in every browser - for each browser I've made a extension wrapper. There is also a testing java-webkit browser, which injects these files directly (so no extension's API).
So I need to create communication API between Javascript and desktop application, which is able to run in every environment (browser-specific implementation would be too "expensive" to maintain).
So I was thinking of sockets. But there is only Websocket protocol support in javascript. Client looks simple, but I'm afraid that server-side would require too much work and dependecies.
Could you give me a tip, for other technologies, which compatible with my requirments?
And second question - to the sockets - would it be even possible to access socket on "localhost:port" from these's javascript files, when they are Content scripts running in page's context?
Thank you for advice.
Sockets is the way to do it. #Luckyrat has provided some code on how to do it from a Firefox Addon:
https://stackoverflow.com/a/17459064/3791822
I'm trying to create a client side app in javascript that downloads a sqlite database off a server and allows the user to modify it. This app needs to be all client side though, and can't rely on features only present in firefox for example. Is there any framework you are aware of that provides these features?
(Perhaps emulated of sorts?)
Short answer: you can't.
Long answer: Javascript, by design, cannot access local machine files. If it's okay to keep the db server-side and have the client interact with it, the server can execute queries and updates to the DB based on what the client asks it to do (a la web service). This is true for HTML5 browsers as well.
Some browsers, such as firefox and chrome, come with packages that will allow the browser to talk to sqlite dbs, but they are not written in javascript and can do things that javascript cannot, which is why they are included as browser-specific packages instead of as js scripts.
I'm using jQuery Mobile framework. I'm having a server which hosts a website. The user can connect to website through mobile browser and download files (.doc, .xls, .pdf etc.) from that website. I need to open the file which is saved in the user's mobile programmatically using JavaScript. I tried to open using location.href="file://sdcard/download/test.doc".
But it didn't work. It showed permission denied. Is there any way to this? Please help. Thanks in advance.
For security reasons, browsers will block all access to your local file system. You would have to use other extensions to access those files--or download them to a local variable instead of the file system.
If regular old JavaScript could access your filesystem bad people would be able to do really bad things with greater ease and efficiency. There are a couple of possibilities if you are not using a browser:
http://www.c-point.com/JavaScript/articles/file_access_with_JavaScript.htm
http://www.webreference.com/js/column71/
Those articles are fairly platform specific, and do not leverage the best practices for security though. Caveat Emptor
You can't access the filesystem from pure web-based JavaScript alone, especially not in a cross-platform or cross-browser manner. But you can access the filesystem from ActiveX Controls on Internet Explorer, from Firefox extensions, and from Java applets, all of which you might be able to interact with using JavaScript. Of course you'll have to get the user to install the ActiveX, extension, or applet on the browser first.
There is no way to do this in Javascript. Access to local files is categorically denied for security reasons.
You can link to the file using a <a> element but even that is disabled in most browsers.