views:

445

answers:

8

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?

A: 

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.

Jab
+5  A: 

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.

smorgan
The Logitech Harmony remote software used to be done in a similar manner, and it was quite obvious that it wasn't a native Cocoa application given how painful it was to use.
Brad Larson
WebKit and JavaScriptCore has a lot of vendor-specific CSS and JS features that allow a broader range of access to native Mac look and feel and behavior than standard HTML/CSS/JS do by default. Unfortunately, the last time I checked, a lot of this on the behavior end is badly documented and requires the developer to get into Cocoa docs to find out what's possible. It's probably a better investment to just learn Cocoa if you're developing for Cocoa targets.
eyelidlessness
+1  A: 

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."

Rob Napier
+1  A: 

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.

tmh
A: 

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.

Chuck
A: 

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!

A: 

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.

Adam
A: 

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.

radbourn3