Blog

Sep 27

Dojo on the iPhone conference slides

By on September 27, 2007 1:55 pm

I recently had the opportunity to speak about Dojo on the iPhone at AjaxWorld West. The session was a straightforward, if not colorful, review of the current state of app development for the iPhone.

In preparing for the presentation, I needed to install several native applications in order to create high quality screenshots for my slides. As a result, I presented the audience with an overview of this information because there are a variety of useful development tools that require installation.

Because Christopher Allen gave a talk just prior to mine with an iPhone and iPod Touch Ajax overview, I dove right into specifics about the current issues and problems with iPhone development for Dojo developers. I wrapped things up by walking through a few working examples of Dojo-based applications, some optimized for the iPhone and others not. At the end of the talk, I promised a forthcoming, iPhone-optimized Dojo build that removes features and code for items not supported on the iPhone. We hope to have that ready in time for the 1.0 release of Dojo on October 31.

The press seems to have enjoyed the session, with Network World running a fairly lengthy article titled Unauthorized iPhone Apps Market Flourishes. I should make it clear that my talk focused mainly on pitfalls and frustrations that developers face, but the iPhone is by far the best mobile, open web, development solution on the market today.

Sep 4

The iPhone Screenshot Quest

By on September 4, 2007 11:10 pm

I speak at a number of conferences and am giving a couple of talks later this year about Dojo on the iPhone. Of course, giving a talk without being able to show demos is frustrating, but giving a talk without having high-quality screenshots is silly. There wasn’t a solution known outside of Apple until recently, and it is still a bit of a process, or I daresay a bit of a quest. These instructions are for Mac users… I’m sure the steps are pretty similar for Windows users as well.

Aug 2

Safari on the iPhone: 2 Steps Forward, 1 Step Back

By on August 2, 2007 10:03 pm

I’ve been following John Gruber on Twitter, who just noticed that the iPhone update (1.0.1) now updates Safari with the ability to send key events. Fantastic! 2 steps forward.

But, onkeyup is broken. You see, the onkeyup event is supposed to be called after a key event has officially propagated through the page. This is very important, because by the time onkeyup gets called, the page should have adjusted itself for this newly inserted character. For example, in a text input box, when you press a key it doesn’t show up in that input box until after onkeydown and onkeypress have been called, but does show up before onkeyup is called. Pretty much the whole reason that onkeyup hook exists at all, is so that you can be notified after this change has happened. The iPhone sends onkeyup before the page has been updated. 1 step back.

What this means is that sites that rely on using the onkeyup event to tell what is in their text entry box will break. There is a simple solution though! (other than having to find the key value in the event object) Just use setTimeout, with a timeout of 0 and you’ll be able to see the proper value. For example:

  input.onkeyup = function(e){
    setTimeout(function(){ alert(e.target.value); }, 0);
  }
Jul 12

Filling the iPhone Chat Gap

By on July 12, 2007 8:37 pm

iphone_chat.png Many people are perplexed by the absence of instant messaging on the iPhone. Apple has done great things for SMS with their ichat styled interface. Unfortunately they stopped short of providing a seamless IM experience. Hopefully Apple will add these features in a future software update.

The iPhoneDevCamp in San Francisco last weekend saw several groups working to fill the IM gap by building iPhone compatible IM web applications. I spent part of my time there revising the existing cometd chat app to work well on the the iPhone. Comet’s long-running http connections are ideally suited for chat apps as it provides very low latency. We had already tested cometd on the iPhone, so I was encouraged about the ease of porting the existing chat demo.

Jul 5

Messing around with the iPhone

By on July 5, 2007 12:50 am

Well, the plan was to go through every type of input object, button, and image in Safari on my shiny new iPhone and make notes about what functions were available, how event handling works, and any other fun little goodies that came along. I started out with the good old text input box, and after an hour or two of executing functions in all sorts of different orders and being seriously freaked out a couple of times, I’m worried about the pretty severe limitations of one of the most basic widgets of the web browser:

  • When the input does not have “virtual keyboard” focus, calling its focus function calls its onfocus function, but does not give the input “virtual keyboard” focus
  • When the input does not have “virtual keyboard” focus, but you’ve called its focus function, calling its blur function will call its onblur function. When the input does have “virtual keyboard” focus, calling its blur function does absolutely nothing (which breaks some scripts that prevent input by blurring on focus).
  • When the input does not have “virtual keyboard” focus, calling its select function does nothing, until you scroll or zoom in on the page, at which point it calls both its onfocus and onblur functions. When the input does have “virtual keyboard” focus, calling its select function does absolutely nothing.
  • Calling its click function calls its onclick function as expected.
  • Selecting an input box fires: onfocus, onmouseover, onmousedown, onmouseup, onclick, and sometimes onmousemove
  • Selecting the next item on the page fires: onblur, and (conditionally) onchange, but still no key events.
  • Clicking the “Done” button in the “virtual keyboard” fires: onblur, and (conditionally) onchange, but still no key events.
  • The only key that registers any key events is the return key.
Jul 4

Thinking outside the (browser) box

By on July 4, 2007 3:13 am

Apple’s iPhone web application development tips are yet the latest example of blurring the lines between the power of the web and the desktop. The example that drives this point home the most is Google Maps:

Google maps links open a built-in Google client rather than making a connection through the public website.

On the desktop, we’re seeing Dojo Offline and Google Gears, as well as more proprietary offerings such as Adobe’s AIR and Microsoft’s Silverlight. One interesting thing coming from Apple that has not received much mention is WebKit and Cocoa bindings, including JavaScript bindings. Soon we’ll be able to use open web standards to create native Mac apps!

The proliferation of JavaScript, HTML, and CSS is rapidly spreading to every area of software development, because open web standards are powerful and relatively easy to comprehend.

Jul 3

SVG missing on the iPhone

By on July 3, 2007 4:02 am

Safari on the iPhone does not currently have support for SVG. Safari 3 beta on Mac and Windows is currently the best browser on the planet for SVG performance, so this is a somewhat disappointing omission. We are hopeful that by the end of the year, the iPhone will receive the Safari 3 upgrade, and along with that native support for SVG. For now, we’ll have to wait on dynamic charting and drawing tools due to no SVG and the lack of mousemove event handlers.

Jul 2

Cometd on the iPhone

By on July 2, 2007 2:20 am


It’s been widely reported that Drag-n-drop on the JavaScript layer is going to be a significant challenge. The canonical fun with magnets demo for Cometd relies on Drag-n-Drop for moving magnets around, so that part of the demo is currently a no-op. That said, the rest of the app seems to work pretty well, with the built in version of Safari not skipping a beat in receiving events and moving items on the screen in response to those events. The speed performance is obviously much better with the wifi connection, but we are still having success over the EDGE network as well. Bottom line: Cometd appears to work out of the box on the iPhone!

P.S.: Does anyone know how to take a screenshot with the iPhone itself rather than using a digital camera?

Update: There’s now screenshot utility for the iPhone.

Jun 6

An Insider’s look at Google Mobile Apps

By on June 6, 2007 1:37 am

Google has posted many of the talks from Google Devloper Day 2007 on YouTube. Gummi Hafsteinsson, a Google Mobile Applications Product Manager, gave an excellent overview on building for the mobile web. Key points in the presentation include:

  • Keep it simple–get your site working on a single basic device first
  • Focus on features your users will need while they are away from their desk
  • Resize images so they are just big enough for the device to save the users time and money
  • Be careful of simulators. Many apps will work on the simulator but look bad or crash the real phone
  • Entry level phones are a large chunk of the market but are very limited and your app may crash them

So how does Google stack up against their own criteria for building better mobile web sites? Let’s take a look at mobile gmail.

Apr 24

Mobile Web Apps: Apple iPhone to Wurfl

By on April 24, 2007 2:24 am

Apple’s iPhone has sparked a great deal of interest and excitement in mobile web application development. The iPhone significantly raises the bar for the capabilities of mobile devices. Its large screen and advanced browser will allow for the development of applications never before seen on mobile devices. That said the iPhone will be one device in a vast ocean of mobile users. Developers of mobile web applications will need to provide a version of their app that supports in some way those other devices.

One of the largest problems facing prospective mobile developers is adapting content to the numerous sizes and styles of mobile devices. Screen size, network speed, image format and markup language support are just a few of the variables to consider. Even the iPhone when on the carrier network, is limited to the dial-up speed GPRS network. To compound the problem mobile carriers and handset manufactures are releasing new phones daily in an attempt to one-up their competitors. If you are planning on creating a mobile version of your web app there are open-source tools available that will make your job a little easier.