The Best JavaScript App Methodology

by Mike Levin SEO & Datamaster, 03/19/2009

The time is right. The tech is right. It’s time again to program. The only question in my mind is the context for initiating the execution JavaScript code.

Up until a few days ago, there was no question: a bookmarklet in Firefox or Explorer that loaded a .js file hosted on a Web-accessible cloud drive–in my case, an Apple iDisk. The trick was originally inspired by how Delicious works, but more recently by how Google Notes or Share on Facebook works. The bookmarklet hands off control immediately to a server-hosted file, so you’re not cramming the code in a bookmark. In my case, with it being iDisk, I can load it directly into any text editor.

Good dev workflow. Click a link, and have JavaScript execute it satisfying same-domain policy–meaning you can make additional http requests to that domain. Can you say “JavaScript Crawler?”

It’s like manually triggered GreaseMonkey–perfect for my purposes. But a few days ago, the new Google Chrome was released supporting a GreaseMonkey-like extension system, and their hello world is dirt simple, so now I’m torn.

I’ll probably opt for cross-browser compatible bookmarklets, because I want to stay as technololy agnostic one can get with JavaScript and browsers. I actually feel Sun’s vision of the network as the computer, and Netscape’s vision of the browser as the computer coming true. If things like what I’m doing work out, Microsoft is truely f _ _ _ _ d.

So, browser-compatible bookmarklets it is. Unfortunately, servers are hard to get out of the picture. Occasionally you need them to get around the same-origin policy of browsers. JavaScript sucks as a data-store, so you need to mash up with some cloud storage. I’m choosing Google Spreadsheets for my application. Of course, you need to host the .js file somewhere. And occasionally, things are just much easier to program in your favorite language–which browsers don’t allow (until Google’s native code inititive matures).

So even when embarking on the great adventure of browser-based programming, you need a server. The .js file probaly only

[]