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
Related
I'm working on a webpage that has to work offline when it's finished. No XAMPP or other services available, so PHP is no option.
It has to create a new file, edit a filename (which would be the best solution) or move a file into another directory. This action has to be called from a function in jQuery.
I've read that Python could to this but as long as I read Python needs a web framework and a configured Apache as well, so if it's right Python is no possibility for me as well.
Is there any way to do this with JavaScript / jQuery or anything else which works offline?
No. It won't work by Design. Imagine, you visit a Website and it would install virus.exe into your Windows Directory (For example Autostart).
Html Pages are for Displaying Informationen to the User. Javascript is supporting it with dynamic Features. The Browser grant Rights for Loading other Information and nothing else. Everything which would affect the System, could not handled by Script.
If it should run from Web, you need a Plugin (Like Java). In your case (Offline Use) consider to write a Desktop Client (C#, VB.NET, Java, C++).
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.
I have written a program in HTML, Javascript and CSS, and I am displaying it in IE. I'm dependent on IE because data is written to, and read from an Excel File and I need to use ADO for that.
However, the "An activex object is trying to interact with oter parts of the page..." prompt is very irritating, seeing as it is an application that will be store locally on the user's computer, and will not be a web application. I find HTA difficult to debug and it seems as though it hasnt been updated in a while. I can't add my application to trusted sites and use custom level to deal with the activex prompt because it is stored on my computer. I was thinking on storing it on my local host, as I would then be able to add it to trusted site, but this would require adjustments to the user's computer.
Ao my question is, what is the best way for me to display my html/javascript/css program, as a desktop application, with little or no need to change any settings on the user's computer, that could read/write to and from excel spreadsheets (or if you know a better way of dealing with this data), and is stores on the user's couter rather than as a web application?
Any advice would be greatly appreciated:)
Write a windows application instead and use the Apis of excel. Your model of HTML CSS js will not work well with security.
I currently have a web app that uses ActiveX / JScript to read files and to read the registry for a web page. Originally when designing the page, it was supposed to be on a site that only supported IE...then things changed and it is no longer that way. My question:
HTML5 is able to read files. Is there any way to read registry entries outside of ActiveX and internet explorer using javascript/html? I'm trying to avoid having to port the entire applet over to use Java, but that may be my best method.
The page makes no modifications, it only reads text files and registry entries.
It is not possible without a third party plugin.
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.