making exe form HTML and Javascript - javascript

I was wondering I have PHP based server side stuff that accepts ajax requests and sends back JSON for JS. And I have HTML and JS based "client" now I would like to create exe(windows aplication) that would look the same as the "client" in browser but without browser. Preferably somehow grab that HTML and JS and "compile it" to regural client that would still send out AJAX calls and procesing JSON data.
Edit:
To clarify things:
Server(on webserver) is PHP procesing incoming AJAX calls and diplaing JSON as result.
Client(what I want to convertt to exe) is HTML and JS(Jquery) page(application).
I want for user to have option two to dowload client for windows so he/she dont have to use browser.

With https://electron.atom.io/ from Github you can develop Windows, Mac and Linux applications with Javascript, Html and CSS. You can also build mobile application with your web development skills. https://cordova.apache.org/.

You can use Electron, but if you just want something quick and easy to use, try Scriptonit. It's exactly for this kind of use. (Check out the documentation and the examples to see if this is the one for you.)
It's basically one exe plus a few sidecar files in a folder called app/, then it just works like a local browser without the frames & head. Also, it can access local files and run OS commands, even capture their output.
Side note 1: Yes it's mine, as you can see on the link - but no, that's not why I'm recommending it
Side note 2: It's 0.9 so it's not perfect, let me know if it misbehaves.

I don't think you can make a desktop application with markup languages. but then am also a newbie in this stuff but what I think you need is to develop a GUI in a programming language like java for example Swing docs.oracle.com/javase/tutorial/uiswing/ to mimic the apearance of your webpage. Then connect to your server by socket programming.

Related

query for an AD user with JS (in html page)

I building an HTML page and in one of its text boxes I want the user to input the employee number and for it to be validated (whether the number is already in use or not) with a simple button.
The AD query itself is pretty simple and a single line in powershell can do it.
Get-ADUser -Filter {employeenumber -eq "XXXXXXX"}
the problem starts (at least for me) in how to integrate this into the HTML page. I started reading in google but all the answers I found take me into PHP and JavaScript and really complex scripts (50+ lines of code) and since I have no knowledge in any of those languages, it becomes a tedious job for (what i assumed) a simple thing.
Is there a simple way to accomplished this (either by writing a function in JS or by calling for an external PS script)? The HTML itself uses a simple <table> and some buttons that run very simple functions from a .js file located in the same folder (no IIS or other web servers are involved. Im running this locally for now).
Active Directory works with the LDAP protocol and doesn't have a RESTful API by default.
It is impossible to send an LDAP request from the front-end side (I.E from the browser). See this post
In many aspects (security, reliability, etc) the best way to do this would be to do this on the server side.

Altering a server file through javascript code

So I have a setup of a tablet connected to a Raspberry Pi computer. I want to be able to have a webpage hosted on the Pi change the contents of a file also hosted on the Pi (which will be used in a python script that i have written). I tried having the file inside a hidden iframe, but while my javascript ran, it didn't ever actually change the contents.
How can i set up communication between the webpage and the server files? I know nothing about jQuery in the slightest, but if i have to use it, I will.
While you can actually do something with files in HTML5, you must know that Javascript is a client-side script. In other words JS 'runs' on the persons browser and not really your server.
Languages like PHP actually run on your server, and therefor are able to achieve what you want.
I'm not THE Javascript expert, and you might even be able to modify a server file with JS but it will be 'hacky' and have a poor implementation and you might need to run a sort of API on your server that actually does the changing..
Save yourself the trouble of doing it like that and pick the right language for the job. I would suggest PHP. Its fairly easy to set that up and run the website. PHP has enough ways to create, view and modify files on the server itself: http://php.net/manual/en/book.filesystem.php

Webpage create / edit file

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++).

Create ActiveXObject on *server*

I have created a little html stub that allows a user to compare various spellers. I would like to include the Word speller and I have written code in a .js file to create an ActiveXObject thus:
var wordApp = new ActiveXobject("Word.Application");
This works fine on my local machine but I get the dreaded 'Automation server can't create object' error when I try it on other machines. I have searched and read the various articles on the topic and I understand that what I am trying to do is very,very bad, not safe, doesn't work on any browser than IE, and so on. This is for an internal test app in a trusted environment and all I want is for others to be able to access the page and see the result without forcing them to make extreme changes to their security settings.
So, here is my question. Is there a way that I can get this to run server side on my machine running IIS and hosting the website? Ideally I would like to be able to insert my HTML into an aspx file and, when the submit button is pushed, have it either run all the javascript on server side or at least run the portion that calls the activeX code. If this isn't feasible, can I migrate the specific functions that call the activeX and get the data to C# or VB and still run the safer functions in JS?
Thanks for your advice!

Is it possible to "upload" a file only with client side ? (no server involved)

I am trying to do a simple thing:
Let the user choose a txt file, and save its context to be used on the client side only.
no server side needed.
Is it possible ?
Thanks.
It is possible to do so with HTML5 Files API as explained in these resources:
https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications
http://www.html5rocks.com/en/tutorials/file/dndfiles/
I guess you mean "save its content" and conclude you want to do anything with this content on the client side, e.g. extract some parts to fill a form. Anyway saving the whole file unchanged, on the same machine where it comes from, does not make sense.
So the problem is not how to upload, but how to open/read a file. You can do this with a Java Applet, Flash, Silverlight, ActiveX ... just to name a few.
JavaScript is not an option. It cannot access the file system.
If the html page, that is hosting your javascript, is from a remote server. This script is not trusted to do actions on your local filesystem.
<Obscure solution mode level = 1>
You can give more trust to a page, but this is something your user has to do. If this is an app/web only for use within an enterprise, you can probably do this centrally. And every browser handles this differently. So it is not something you can rely on, when you do not have a limited userbase.
<Obscure solution mode level = high>
If your (enterprise) users are using Internet Explorer, you could also create a HTML Application (simply give your html page an hta extension). These pages have full trust, but can only be started from a trusted location, or require confirmation from the user.
The only way you can acheive this successfully is to build an ActiveX type plugin/component (or java applet) you will have much more control of the client machine.
No. JavaScript cannot access the local filesystem.
However, you could install a webserver on your machine and e.g. run PHP on that one. Then you could do it without ever sending your data over a network connection. That would require you to do your data processing in PHP though.. probably not what you want. Or you could simply send back the data to your javascript.. but that'd be pretty awful to run an upload just to make the data available to JavaScript.

Categories

Resources