Live data from Hacker News

Offline First – A better HTML5 User Experience

blog.joelambert.co.uk

1–10 of 20 posts

Re: Offline First – A better HTML5 User Experience

#2
For most apps (which derive their usefulness from dynamic content), what's the point? Is an app that loads but does nothing really worth all the extra development time?

That being said, if you're already making a mobile app or API to go with your site, it does make sense to decouple the frontend (HTML/Cocoa/whatever) from the backend so you only write the backend once. Best way to have an up-to-date, useful API is to use it yourself.

Re: Offline First – A better HTML5 User Experience

#3

For most apps (which derive their usefulness from dynamic content), what's the point? Is an app that loads but does nothing really worth all the extra development time? That being said, if you're already making a mobile app or API to go with your site, it does make sense to decouple the frontend (HTML/Cocoa/whatever) from the backend so you only write the backend once. Best way to have an up-to-date, useful API is to…

Its definitely worthwhile, web apps are becoming richer all the time. Even if new content can't be retrieved, as a user I expect to be able to access/consume data the app has already presented.

I'd argue the development is no more difficult either, in fact it lends itself to a style that is easier to unit test.

Re: Offline First – A better HTML5 User Experience

#4
So, in other words, the web is rediscovering client/server programming. Welcome to 1990, everyone!

More seriously, though, I think a lot of the reason for the historical tendency towards server side rendering has been:

* Clients were slow: remember, until V8 raised the standard for speed, Javascript VMs were slow. So doing a lot of rendering or data processing in Javascript was a bad idea, since it negatively affected the user's experience with their entire computer, not just your site.

* DOM Manipulation is hard and inconsistent between browsers: Yes, JQuery and friends hide the native DOM API. But we have to remember that it wasn't always the case. Rich client-side libraries are all quite young, comparitively.

* Offline capabilites were non-existent: Even today, the HTML5 specification, as implemented, only grants you a fraction of the data storage and retrieval capabilities available to even the most sandboxed application. And previously, these capabilities simply weren't there - if your app needed to store data, it had to store data server side and tag the client with a cookie or some other for identification to keep track of which data belonged to whom.

Yes, there is progress being made on all three fronts, but you can't expect developers to throw away years of best practices in a day, then immediately turn around and write HTML5 webapps. I think the evolution towards a more balanced computing model (where more of the computational load is being handled by the client) is ongoing, and will accelerate as browsers become more capable.

Re: Offline First – A better HTML5 User Experience

#5

So, in other words, the web is rediscovering client/server programming. Welcome to 1990, everyone! More seriously, though, I think a lot of the reason for the historical tendency towards server side rendering has been: * Clients were slow: remember, until V8 raised the standard for speed, Javascript VMs were slow . So doing a lot of rendering or data processing in Javascript was a bad idea, since it negatively affect…

It's also a change in mindset in the 'developer community'. Up until let's say 5 years ago, Javascript was considered plain dirty. Javascript was a non-portable hack that was only to be touched in the most extreme circumstances. Websites that didn't work on Lynx were reviled. Oh how things have changed, and yet have stayed the same at that same time (i.e., your 'welcome to 1990' comment).

On a related note, the last couple of weeks I've been working on rewriting an old (2000-era) web app, originally written in Visual Interdev. Visual Interdev was widely derided back then, it was something only Visual Basic 'programmers' (the chaff of the programming community) would touch. Turns out that many things it did are a lot more popular nowadays - client side calculations, validation, dynamically updating the UI, etc. Of course there was no XMLHttpRequest, so by modern standards it was quite limited; still, it's funny how something so derided back then just turned out to be ahead of its time.

Re: Offline First – A better HTML5 User Experience

#6
People are consuming more content on mobile year on year, and using offline storage and capabilities have been around for the past year or two; how this is only just bubbling at the surface at conferences is beyond me.

Take THE white elephant example; Facebook mobile. The shift is evident, my girlfriend doesn't use a traditional desktop/laptop anymore she consumes all her Facebook glutton through her mobile. If it takes more than 5 seconds to load she gives up.

There is a grey gap in knowledge of accepted and logical practice with what stays online or offline but for example the whole of Facebook's UI could be cached on a mobile and just reload the updated news/feeds.

Re: Offline First – A better HTML5 User Experience

#7
I'm planning on queuing up updates when offline for my app. On the technical side of things, it's incredibly easy when done from the ground up. In fact I think it's made the entire thing much cleaner and far easier to develop.

The harder part seems to be communicating with the user. If/how to let them know they've gone offline, and what that means for their experience, and if they're allowed to create/update content, what will happen when they reconnect.

For example, the next question for me is what to do with conflicting updates, ie when a user updates a document offline and reconnects, and the document has been updated by a different client while they were offline. Discarding or merging isn't a problem from a technical stand point, the problem is presenting it to the user, and striking a balance between doing what the user wants/expects, and not bothering the user with a ton of questions about which of their changes they want to keep/merge.

Re: Offline First – A better HTML5 User Experience

#8
post #7

I'm planning on queuing up updates when offline for my app. On the technical side of things, it's incredibly easy when done from the ground up. In fact I think it's made the entire thing much cleaner and far easier to develop. The harder part seems to be communicating with the user. If/how to let them know they've gone offline, and what that means for their experience, and if they're allowed to create/update content,…

It's still quite tricky to to detect a reliable 'offline' state with HTML5. Using navigator.onLine tells you that you 'might have' internet access but even then you may actually be offline. Bu I agree that the most important issue is how to communicate the degradation to the end user.

Re: Offline First – A better HTML5 User Experience

#9
post #5

So, in other words, the web is rediscovering client/server programming. Welcome to 1990, everyone! More seriously, though, I think a lot of the reason for the historical tendency towards server side rendering has been: * Clients were slow: remember, until V8 raised the standard for speed, Javascript VMs were slow . So doing a lot of rendering or data processing in Javascript was a bad idea, since it negatively affect…

It's also a change in mindset in the 'developer community'. Up until let's say 5 years ago, Javascript was considered plain dirty. Javascript was a non-portable hack that was only to be touched in the most extreme circumstances. Websites that didn't work on Lynx were reviled. Oh how things have changed, and yet have stayed the same at that same time (i.e., your 'welcome to 1990' comment). On a related note, the last…

I once read a book about MFC (Microsoft foundation classes) programming in Windows. This book had some web programming chapters, and one of them was DTHML (dynamic HTML) how it was called then. The author even said "Silly HTML" to it (it makes more sense in German, because silly starts with a "d" in German) and said that this is absolutely worthless, cause it will never work in more than one browser.

These were the days. Funny how some things change and "silly ideas" are all the rage.

Re: Offline First – A better HTML5 User Experience

#10
post #7

I'm planning on queuing up updates when offline for my app. On the technical side of things, it's incredibly easy when done from the ground up. In fact I think it's made the entire thing much cleaner and far easier to develop. The harder part seems to be communicating with the user. If/how to let them know they've gone offline, and what that means for their experience, and if they're allowed to create/update content,…

It's still quite tricky to to detect a reliable 'offline' state with HTML5. Using navigator.onLine tells you that you 'might have' internet access but even then you may actually be offline. Bu I agree that the most important issue is how to communicate the degradation to the end user.

Yeah, I saw a lib the other day that tried to offer this but was pretty hit and miss, and checking into the methods available didn't fill me with confidence. Right now I'm only considering the client offline if an attempt to hit the server fails. If they're trying to save something, queue it up to do later, if they're trying to retrieve something, check if theres a copy locally, if not let them know what's going on.

The problem with this method is ideally you'd like the client to know it's reconnected as soon as possible, and start working through the queue. I figured the most foolproof way was just periodically trying to talk to the server when you think you're offline. It'd probably be better if you had a solid method of receiving actual network related events like disconnecting and reconnecting, but the lazy 'just keep checking' method is workable.

The bonus of it is it works the same if it's a problem on the servers end.

Post reply on HN