safari

AJAX Web Apps In iOS 6 Are Sort Of Broken

Next Story

The Best Apps Optimized And Ready For Your New iPhone 5: Evernote, Tweetbot, Tiny Tower And More

I noticed some odd behavior in mobile Safari on iOS 6, and while I thought it to be just a minor quibble on my part, it turns out that it’s actually something of a notable bug, now affecting web developers targeting the platform. The problem I noticed is that little, spinning loading indicator (or whatever you call it) at the top of mobile Safari which tells you when a site has finished loading all its parts. On some websites, that little guy just runs and runs, never completing, as if there’s still more to load. Kind of annoying, right?

Well, apparently, it’s not just a little annoying to picky users like me – it’s annoying developers too. It’s related to a bug which impacts how websites function, and is causing some web apps to not work properly.

The problem is related to something called long polling, and that’s something that affects your usage of a lot of AJAX web apps in Safari (apps that use HTML, CSS and JavaScript, as many modern-day web applications now do). I first noticed the issue on Google Readers’ mobile site, then on Gmail’s mobile site, and on the Google+ mobile site. Oh yeah, and on Google Maps, of course. (Yep, I’m on Google stuff a lot). A post by Greg O’Lone on the company blog for Real Software, makers of cross-platform development tools, explains the problem. And while he doesn’t specifically discuss that annoying little spinning thing, it’s related to the same issue.

And really, the spinning thing is the least of developers’ concerns here. Other problems may include things like missing images, unresponsive interfaces, and random disconnects, he says.

So here’s what’s happening. When a browser loads a website, it often has a few simultaneous connections going to pull for content. For example, images may be loaded at the same time as the main page content. Long polling, then, is something that’s used to show you new content (AJAX style) without the end user having to refresh the entire page. It does this by holding one connection open.

O’Lone says that in iOS 6, the normal process is all messed up, basically. Instead of letting an app and server use multiple connections, only one connection at a time is allowed. Because only one connection at time works, other requests – like those for images, for example – are prevented being sent to the server until the first request times out. He says he filed a bug with Apple and is communicating with the Safari team about this.

But it looks like another developer (spotted on Hacker News, of course) has a different explanation. He says it’s not a one connection per server thing, but rather an issue that occurs if the long polling connection starts before the page is fully loaded, and he offers a fix.

What’s weird is that this wasn’t spotted by Apple or the numerous developers using the iOS 6 beta builds beforehand, especially considering how many developers out there also offer web app (and specifically AJAX) versions of their native iOS applications. I’m sure this is something Apple will address, since it’s a problem affecting a bunch of the web apps we know and love. (Conspiracy theory: Apple broke web apps on purpose so you’ll download the native version! Ha ha ha! Kidding, of course.).

Me, I’m just happy to discover that it’s actually a real bug, and I’m not crazy for getting annoyed by it. Now someone, please fix this.