Can you write Cocoa apps with HTML/CSS and Javascript? [closed] - javascript

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 2 years ago.
Improve this question
I was thinking, would it be feasible to create a Cocoa app that is essentially just a an interface with a web view? Or is there some serious limitation when doing something like this?
If it is "feasible", would that also mean that you could do the same for Windows applications?

It's certainly possible to create an application that's just a Cocoa window with a web view inside it, sure. Whether that can meaningfully be called a "Cocoa app" is debatable. Obviously things like the app menu would require some Cocoa glue code, so yes, there are limits to how much you could do in just HTML and JS.
You'd also have to think carefully about how you would handle localization (duplicating the entire HTML and JS source for each language isn't going to be desirable), and there are lots of interface constructs that would be much harder to create than they would be using Cocoa, and/or wouldn't feel native to someone used to the OS X look and feel. And you'll be giving up some performance by using an interpreted language, which may or may not matter for your application.
There are applications for OS X that are built that way, and they generally feel like bad ports; if your goal is to make something that feels like a real Mac application, it's probably not a good way to go.

iPhone OS has fantastic facilities for making web apps act as first class citizens on the device. You can have your web apps icon added to the springboard just like a Cocoa App, you can store data locally and lots of other really neat stuff... Check out these examples or the ADC documentation.

Sure. PandoraBoy is exactly this. It's a thin wrapper around an existing flash app with Javascript bridges. I've worked on other UIs that are programatically controlled WebViews using direct DOM manipulation to get very nice effects (without ever giving the feel of "a web app"). You can use the ObjC/Javascript bridge to let Javascript call ObjC, and WebKit makes it straightforward to run Javascript from ObjC.
Related, but in the opposite direction, there's Cappuccino, which is a Cocoa-like framework in Javascript.
I'm not clear what you mean by "do the same for Windows applications."

Titanium could help you a lot, it is basically a Cocoa window with WebView (the thing you are looking for), but (the good part) with JavaScript bindings to native stuff like access to filesystem, Menubar, Dock icon (ie. badge), sound, etc. Plus it will run on Mac, Linux, Windows, iPhone and Android!

Yes, there are quite a few apps that do it. I think they usually store the html files and use jquery to fetch the updated data. It mainly just gives the user a marginally faster experience, since you are only retrieving data and not the bulk of the HTML.
The limitations are mostly due to the fact you don't have access to all of the iPhone controls and libraries. MapKit, Mail etc.

Of course it's possible. There would be pretty big limitations. Such an app couldn't do anything that a Web page couldn't do. So, for example, using the standard systemwide document-handling support would be out unless you wrote supporting Cocoa code.

Not quite what you were asking but...
mProjector is an OS wrapper for Flash. It's like an extended version of a Flash projector with a system API giving you access to Mac/Win OS features.
This will give you the abiliy to use web skills to build a cross platform desktop app. It's cheaper and better than the other main option, Zinc.

You can write Cocoa apps with HTML in 2 ways.
Electron
Electron is a framework that turns html, css, js into a cocoa app.
WKWebview
WKWebView is a web browser used in Safari Web Browser.
If you chose WKWebView, make sure you put your html app in a webpage because people can go into the app resources

Titanium bills itself as open source software, but developers are required to register an account and maintain an internet connection to proprietary server software in order to make use of the platform.

Related

Protecting Apps with Apache Cordova MS VS Extension on App Stores

Just have a question about apps that are uploaded on the Windows Store, Andriod Store, and Apple Store. I have never built an App before for any of the three stores, but the Multi Hybrid Extension for Visual Studio seems to be a great start to cover all three Platforms.
How do I protect my code for apps that are uploaded to the three stores? The core development for the Apache Cordova extension is done in HTML5 and Javascript. On a regular HTML / Javascript website, the end user can simply right click and View Source of the page and see all the code I've written.
My question is, how is this protected for apps that are uploaded to the app store? Will someone be able to reverse engineer my application and get the code and simply re-sell it?
Thank you all for your time
You want to, develop once, deploy many. Then, you’ll want to use HTML5 to do it.
You can use Apache Cordova directly, but you’ll want to use a service like Telerik AppBuilder, Adobe Phonegap or Intel XDK.
Regarding your question, your best bet is to use a good JavaScript source code obfuscation service to protect your sources before publishing. There is no such thing as a 100% full proof solution when it comes to JavaScript obfuscation, but professional tools such as JScrambler can take you a long way. At least JScrambler I know that it supports Mobile and HTML5, which is good because they make sure the resulting code is compliant.
There are other tools, even free ones. But be careful though, there are tons of other tools that do obfuscation, encoding/packing or minfication that seem to provide protection, but are reversed in a few minutes. So, unless you really know how to tell the difference, I recommend that you rely on a professional service.

Developing a cross-platform self-contained HTML application

I am thinking of building an application, kind of like TiddlyWiki in the sense that everything is self-contained in an HTML file, or at least in a bundle where a user won't have to install anything. It works on just about any browser, and on mobile phones (Android and iPhone), and in some browsers (e.g. Firefox), manages to save to the local filesystem without a plugin (albeit, it launches many security warnings, but there are other solutions for that). Other browsers happen to use a Java plugin to bypass this restriction.
Are there any technologies that exist that make this possible? HTML5's web storage sounds like it would be almost perfect, except that the data would be tied to the browser.
Any assistance would be appreciated (even if that just means editting / retagging the question to get more folks looking).
Whats about the fileapi: http://caniuse.com/#search=fileapi
I am just adding a relevant comment with this but not exactly an answer...
When you are saying that you want to develop application which contains everything... Then I would like to add about Titanium, PhoneGap, and others (Corona)...
This softwares provides JavaScript base which will be running on all the mobiles (if mobile applications), desktops (if desktop applications) and so on.... But Titanium (as i am working on it) works on the SDK of all the other languages for development...
Now TiddlyWiki, what i have understood from the link is that it is creating a web application or something like that which will work on all the other mobile devices. But this is NOT Good always, Since some application needs to be a NATIVE environment (which is supported by Titanium). Native applications will be much more faster than any other developed applications..

Cross platform paint program for web browsers and Mac devices

I need to implement a paint type program that will run on all major browsers as well as can be packaged as an app on the iPad/iPhone. After some investigation I have learned the following facts (correct me if any are wrong):
Javascript is entirely too slow to handle an app of this type by itself
HTML5 seems like a good solution, it has a canvas tag and everything and can easily be packaged into a UIWebView for a Cocoa app. However, I need to be able to reach the majority market for web users, which unfortunately includes most IE users who aren't using the public beta for IE 9.
Flash vs. Apple
Right now I'm debating just making two completely separate apps, one in OpenGL ES for iPad/iPhone and another in something like Flash for web browsers. I was just wondering if anyone had an immediate solutions in mind to make one app instead?
I'd question the accuracy of your first point (Javascript is too slow). Since it's possible to run Quake II in pure Javascript, it's likely that your paint application is less resource-intensive and thus could also run. Of course, one could ask how much optimisation effort and/or experience is required to write performant Javascript of this standard - I can't give you an answer there.
But I'm certainly sure that it's possible to get enough performance out of Javascript to implement such a paint tool, in any modern browser. That doesn't preclude the other options, though; using JS along with HTML 5 sounds like the ideal solution here for "out of the box" cross-platform compatibility.

Launching an application from a browser (platform and browser independent), best approach?

Please forgive a question that has been addressed in some form or fashion previously. I have numerous test applications that run on various platforms from Windows 95, Windows XP, SUSE, RedHat, and other forms of *NIX. Currently, the mechanism has a native application that queries a database for some information then launches the test application to perform the test. This said program is a "launcher application" which I am trying to convert to a "HTML/Javascript Launcher Application". In addition, this "launcher application" needs to known when the test application is completed, then collect the test result then store the results in a database.
I have read that launching an application (executable) from HTML is not permitted, but this is entirely true in the sense (if I understand correctly). From what I have read here on SO and other sites, I have the following possible solutions:
Registering a unique protocol to an test application (SO Link)
Using Java to launch the application
Adobe AIR or its opensource counter part, Titanium by Appcelerator
Using WSH, though this will only work on Windows platforms
What would be a good (or best ) approach to solution this problem? Ideally, I would like to just use HTML and Javascript, but this may not be possible? Thanks for any advice and any example/sample code would be greatly appreciated.
Mark
Hopefully many people will think, as I do, that this is a 'bad idea'™, simply because in order for it to work you must allow your browser to launch software, which would be a huge hole in security, allowing access for all sorts of nasties.
Given you are cross platform I'd suggest you stick with a dedicated laucher application, but code it in java. This is the most common solution used in the java applications world which regularly crosses os's.
You could give JNLP (java network launch protocol) a try... Really easy to distribute and deploy full fledged applications in a platform independent manner. More or less through the browser if you like...

I want to write a desktop OSX or Windows app in Javascript -- any experiences?

I'd like to write some small applications for Windows and OSX.
Portable is good. For instance, the simple TclKit solution for TCL would work well if I could stand to look at Tcl for any length of time.
I'm considering using Javascript + extensions -- I really like Javascript -- seems to me there should be some way to connect a Javascript engine to WxWin or even the Tk toolset -- it's been done for Perl, Python, Ruby, etc. Why not JS?
Any comments appreciated.
I would rather recommend using Adobe Air execution container, it offers way more capabilities / OS integration features compared to HTA of Microsoft or even XULRunner of Mozilla.
If you want to write a desktop app in Javascript, check out HTA: http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx
Here is an example of an app that I wrote a long time ago in HTA: http://www.boltbait.com/htmleditor/
Hope this helps.
If you have experience with HTML+JS web applications, I'd recommend Mozilla XULRunner. It gives you native-looking interface widgets (every piece of Firefox interface is a XUL element), and a workflow similar to building HTML-based interface.
You define the interface using XUL, an XML-based language, so it's almost like writing HTML, minus browser incompatibilities and CSS (you can use CSS, but only if you want). All application logic can be written in JavaScript, but in XULRunner you can do a lot more in JS than in a browser (read/write files, execute system commands, make cross-domain XMLHTTPRequests, and a lot of other stuff).
More: http://xulplanet.com/
A lot of example applications: http://code.google.com/p/xulapps/
Mac OS X users tend to dislike applications that don't follow usability guidelines of the platform (menu must be at top of the screen, standard shortcuts & drag'n'drop must work, "OK" must be at right-hand side of alertboxes, no "Apply" button in prefs and so on).
With one-size-fits-all toolkit this may be very difficult to achieve.
The good news is that there's JavaScript<>Cocoa bridge that can be used to create stand-alone full-featured Mac OS X application in JS – just keep front-end and back-end of your application separate enough to be able to plug different UI for each OS.
Rhino would probably give you access to swing. Though, I don't know how much work would be involved.
On the other hand, building a swing app with JRuby is so easy even a sock puppet can do it, so it shouldn't be too hard.
Definitely if you want to implement it using JavaScript, Adobe Air is the way to go. You will even have support on Linux.
Give Titanium Appceletaror a look: http://www.appcelerator.com/.

Categories

Resources