Web application run without browser as a programm [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have made a website wich uses HTML, PHP, Javascript and Ajax and is working based on MySQL database. My question is if there is a way to make this whole website run as a program with no need to open browser. Like outlook or filezilla where both are programs involving servers and web but they need no browser.
I dont expect you to give me a step by step guide but only to tell me if this is possible.

You can use a headless browser, like Zombie.js that will allow you to browse your app programatically without employing a graphical browser. It supports AJAX call and everything.
This is usually done for testing whether the web app works as expected.
Anyway, if you want your app to be used without a browser, best you can do is transforming it into a console app.
If you want the app to be used from both the web and console, or other environment, you can make it work RESTful, and develop 2 interface layers: web, console or whatever you need, all of them consuming the same services so the functionality will be the same.

Sure,
you can develop a java application which uses for example JavaFX on the presentationlayer and there you'll have a class called WebView within you can display your HTML pages.
But you need to run your PHP Application on a WebServer which renders the page on runtime / calltime and serves the data. On this server you also run your MySQL Server.

You could try HTA (HTML Applications). Note that its a product of Microsoft and I have tried this only in Windows.
It acts as an stand-alone application and you can do that just by changing the extension from .html to .hta for your main file.
From Wiki:
An HTML Application (HTA) is a Microsoft Windows program whose source
code consists of HTML, Dynamic HTML, and one or more scripting
languages supported by Internet Explorer, such as VBScript or JScript.
The HTML is used to generate the user interface, and the scripting
language is used for the program logic. An HTA executes without the
constraints of the internet browser security model; in fact, it
executes as a "fully trusted" application.
The usual file extension of an HTA is .hta.
More Links:
http://en.wikipedia.org/wiki/HTML_Application
http://www.htmlgoodies.com/beyond/reference/article.php/3472841

Related

How to crawl corresponding links from a drop-down menu in Java? [duplicate]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to write a web crawler that can interpret JavaScript. Basically its a program in Java or PHP that takes a URL as input and outputs the DOM tree which is similar to the output in Firebug HTML window. The best example is Kayak.com where you can not see the resulting DOM displayed on the browser when you 'view source' but can save the resulting HTML though Firebug.
How would I go about doing this? What tools exist that would help me?
Ruby's Capybara is an integration test library, but it can also be used to write stand-alone web-crawlers. Given that it uses backends like Selenium or headless WebKit, it interprets javascript out-of-the-box:
require 'capybara/dsl'
require 'capybara-webkit'
include Capybara::DSL
Capybara.current_driver = :webkit
Capybara.app_host = "http://www.google.com"
page.visit("/")
puts(page.html)
I've been using HtmlUnit (Java). This was originally designed for unit testing pages. It's not perfect javascript, but it hasn't failed me in my limited usage. According to the site, it can run the following JS frameworks to a reasonable degree:
jQuery 1.2.6
MochiKit 1.4.1
GWT 2.0.0
Sarissa 0.9.9.3
MooTools 1.2.1
Prototype 1.6.0
Ext JS 2.2
Dojo 1.0.2
YUI 2.3.0
You are more likely to have success in Java than in PHP. There is a pre-existing Javascript interpreter for Java called Rhino. It's a reference implementation, and well-documented.
Rhino is used in lots of existing Java apps to provide Javascript scripting ability within the app. I have also heard of it used to assist with performing automated tests in Javascript.
I also know that Java includes code that can parse and render HTML, though someone who knows more about Java than me can probably advise more on that. I am not denying it would be very difficult to achieve something like this; you'd essentially be re-implementing a lot of what a browser does.
You could use Mozilla's rendering engine Gecko:
https://developer.mozilla.org/en/Gecko
Give a look here: http://snippets.scrapy.org/snippets/22/
it's a python screen scraping and web crawling framework used with webdrivers that open a page, render all the things you need and gives you the possibilities to "capture" anything you want in the page via

How to serve HTML + JS + CSS webapp from my machine so that others can view it? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm a newbie developing a small web application that uses HTML, JavaScript (Angular 1.5.0) & CSS. I am using Grunt to process, jslint, minify my javascript and CSS files. This front-end communicates via HTTP Rest calls to a Django application that is also running locally (which has its own database)
This webapp currently lives only on my laptop (MacBook Pro) and I use the PyCharm IDE to edit the files. When I want to test out the app, I simply go to http://localhost:63342/myapp/index.html#. PyCharm's built-in webserver serves it up for me and I can play with it there.
However, I want to allow a select few people to also access the webapp from other locations on the internet. When they try to access http://MyPublicIpAddress:63342/myapp/index.html, they get connection denied.
What is the quickest/easiest/simplest way I can share my webapp with those other people? I do not know much about setting up and configuring Webservers, so if you can give me the simple/easy instructions (or point me to a doc!) that would be most appreciated.
I posted this question to the PyCharm community forum here, but got no response.
Edit
Many answers say I need hosting service. Yes, If I want to deploy my website to a fixed IP address. But is there no way to simply allow them to briefly visit my webapp while temporarily running a toy web-server on my laptop? This is not a long-term solution I understand. But just to give them a peek. If possible I would like to avoid the effort and learning-curve involved in pushing it to a hosting service. I would have to setup the back-end API, database, etc (which are all currently running locally)
There's many services that allow you to host your project online.
For small projects
CodePen: http://codepen.io/
Plunker: http://plnkr.co/
kodeWeave: http://kodeweave.sourceforge.net/
For large projects
Cloud9IDE: https://c9.io/
Koding: http://koding.com/
Github: https://pages.github.com/
Sourceforge: https://sourceforge.net/
Heroku: https://www.heroku.com/
BTW: kodeWeave is my project. It uses Github Gists to save and retrieve your weaves online, thus is not actually saved on the site plus it's a very reliable host when it comes to small projects like it is. (Inspiration from Dabblet.)
It's being made kind of as a JSFiddle alternative for mobile devices, except without all the http requests.
It has many libraries built in (Such as JQuery, Angular, Font Awesome, etc:) in addition when you export as a zip file you will get all those libraries (Hence the except without all the http requests comment). You can also export your weave as a Windows, Linux, Mac, Chrome Application, and/or as a Chrome popup extension.
You can watch this video I made that explains how to use kodeWeave for desktop exportation.
I've listed services I use and recommend. I will not list something I haven't tried without warning.
If you have a spare laptop you can use that as a web server. I've never done it myself because it's not worth the this for me. However something you may want to look into
Lastly you can read Creating a Local Server Configuration with PyCharm which maybe the option you're looking for.
Use localtunnel to expose your localhost- https://github.com/localtunnel/localtunnel
You need hosting, or try codepen.io for small project.
Change the configuration in PyCharm to host at 0.0.0.0. You will also need to port forward your router... I would strongly suggest not using this as any sort of long, medium or short term solution.

Can any user read the coding as they're .js plain text files? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm a C# developer, and use XAML for user interfaces. Lately I've been wondering something regarding HTML5+JavaScript development (used in Universal Windows App development, as well as for websites). Javascript is compiled and executed at run-time on the client device. So any user can go into the folder where they're stored on computer, and see all the code in it, right?
There is no unreadable alternative for js and html5. That's why so many websites are so slow in adopting html5 video and replacing adobe flash.
But if your entire application is client side and you worry about your code being stolen you're doing something wrong. Almost any application requires serverside code that isn't accessible.
And it doesn't matter anyway, who cares about some js that makes a div draggable or moves some html around.
I dont think readable javascript code is of any value...what matters is the server side code like php or ASP which really matters in the security of the websites
And even if the developer didnt want the user to read the javascript framework.. what option does he/she have to prevent it..?none!
The client side code is indeed visible by the client. If something is available client side, then you won't need a round trip to the server to get it.
For example you could imagine a simple calculator application. You could write it client-side, in Javascript, the app can ouptut the calculations immediately. Or you could write it server-side (in wathever language you want), which means you need to ask the server for the calculation (with an ajax request probably), and wait for it to respond.
Also some things doesn't make sense on the server-side. Pretty much any action that changes the DOM, which only exists client-side, in the browser.
I wrote about this on my blog a while back, see Protecting Your Code,
as an addendum to my free ebook, Programming Windows Store Apps with HTML, CSS, and JavaScript, 2nd Edition.
The short of it is that JS code it not protected, though you can make things a little more difficult with minification/uglification like many website authors do. You can also take steps by putting some of the code you care about into Windows Runtime Components written in C++ (C# can be decompiled). The only really secure solution is to have code on a server, and draw from that in an app which of course doesn't work for all cases, but is an option.
Note that some of my comments in that blog from 3 years ago might be a little dated. I believe that current Windows Store policy now allows you to load code from a remote server at run time.

How can you convert HTML, CSS, and Javascript into a EXE? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
All of the answers to this question so far as I can see are confusing... can someone give me a detailed way to make EXE apps with HTML?
No. In the strict sense you can't. HTML was mainly invented to design and exchange documents written for a browser (and CSS provides layout information for such a document).
Although, that is not the case anymore. There are many possibilities, where HTML and CSS is used outside of the browser (e.g Gnome Shell is developed with the help of CSS and Javascript or think of Modern UI apps for Windows 8).
So if you consider Windows 8, there is the possibility of creating an app outside of the browser; but technically it is not an .exe It is not an executable.
Another possibility is to make use of the WebBrowser Class, which allows you to write an .exe which makes use of your HTML and CSS.
So there are ways to stuff HTML into an executable, but you can not make it executable by itself, since it is a document/markup language and not a programming language and can not be converted to running code.
There are several possible directions here, and I can't be sure what you really want.
If you have a static HTML site, you can load it into any web browser from a local disk. This is exactly how "Save as complete web page" functionality works in all major browsers. You can even put this on a CD/DVD and cause Window's autorun feature to automatically load it in a web browser. This method (or some variation) is probably what you want.
If it is a non-trivial web app, then it is already an executable, albeit on the server, not the client. (I assume this is not the case). This cannot easily be converted to a desktop app, for reasons obvious to anyone with the skill to do so.
If you want to make the UI of an application via HTML/CSS, that's a whole different story. Its a means to an end; the app is the actual product. But this involves making a real exe: still no cheating.
So, okay. Despite the "no-cheating" claim above, it is possible to build an application using Javascript as the programming language. In this case it is an "executable", but not really an .exe: it's a .js file. You would need a standalone Javascript interpreter for this. But this doesn't necessarily involve any HTML or CSS at all: Javascript is a programming language in its own right, just like the ones other apps are build with.
So no, HTML is not put into executables strictly for viewing pleasure. Its technically possible, but also infeasible: far better solutions already exist. E.g. how do you justify choosing which browser to integrate? Will you force every user to use your exe browser instead of their favorite?
HTML is a language similar to XML - it is interpreted, not compiled. Thus, you cannot make MS Windows executable files (*.exe) with HTML.
This is a common misconception. HTML is a markup language, which means it must be interpreted by an engine that can display the actual visuals that HTML encodes.
One cannot simply compile HTML, CSS, and JavaScript into an executable file. These are all merely scripting, styling, and markup languages that must be interpreted by an engine (which in many cases is executable).
In Visual Studio 2010 you can create a simple window with a WebView element, and you can populate this element with custom HTML, and inject JS, and so forth. This is described more in depth here: http://blogs.msdn.com/b/wsdevsol/archive/2012/10/18/nine-things-you-need-to-know-about-webview.aspx
Finally, you may be thinking about Visual Studio 2013, which allows you to use JavaScript.
JavaScript is a first-class language in Visual Studio 2013. You can
use most or all of the standard editing aids (code snippets,
IntelliSense, and so on) when you write JavaScript code in the Visual
Studio IDE. You can write JavaScript code for Windows Store apps and
Web apps in Visual Studio.
However, keep in mind that all of your JavaScript gets compiled down into the CLR (Common Language Runtime) which can be read about more here: http://en.wikipedia.org/wiki/Common_Language_Runtime

Apple App Store + Phonegap Automatic Updates [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
I have found many similar questions but nothing identical to what I am asking. I am building an app using Phonegap.
It seems that Apple allow apps that request external JS (people using Google Maps and so on), So basically by using a <script> tag in the header and referencing the external js file. My problem is that I want to do something similar but via code, so using jquery getScript.
The functionality all works, but my only worry is that apple say you cannot download code to your app. Surely having a script tag in the header of the app referencing external javascript is exactly that, downloading javascript to the app.
Its basically, exactly the same in my opinion, no matter how you grab the javascript, it's still technically 'downloading' code.
Anybody know the true answer to this, if not, how do I find out? Even if the app was approved, there is nothing to stop me building 20 apps with this code just to find in future that I was lucky and they take them all down.
there are mixed opinions about it. some developers have been given a hard time for approval of the app when using phone gap. i personally prefer not to use it. here is a link to a discussion that has the opinion of many developers.
http://www.linkedin.com/groups/Anyone-uses-PhoneGap-on-iOS-72283.S.106288557
https://devforums.apple.com/message/513221
as i said there are mixed opinions about it. using phonegap does not prevent your app from being approved, but it is clearly mentioned in the doc's that apps that download codes will be rejected. according to apple there is no issue with having javascript codes inside the app but you cannot execute a set of code to download the script into the app from outside. it has to be inside your app. i hope this makes sense to you. but all in all if you are building an app that downloads codes it will be rejected, if you are building an app that has the script inside it and downloads the dialogue ( like Facebook) related to it, no problem.
apple doesn't allow you to load code later on.
Exceptions are part of every rule but the general opionen about this is clear and I wouldn't rely on that
The spirit of this 'guideline' is to ensure the functionality of the app doesn't change in any significant way after Apple's approval. Apple is even locking down ability to change screenshot after approval. This more for security, still the goal is the same. To consistently present the functionality of your app.
Inferring from the title of your question , are you are using <script> or getScript to ensure latest version to the device, as opposed to packaging the app and updating the app?

Categories

Resources