Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use progressive enhancement techniques to progressively load a slow page?

I've got a portal page in ASP.NET MVC with a few different sections (partial views), some of which will be unavoidably slow the first time a user accesses them, because they have to pull in up-to-date data from an external internet source.

Some of this data can be loaded almost immediately, but the old "Web 1.0" design just goes to a "loading" page until all of the data is available. I'm trying to improve the user experience by immediately displaying the local data, and then using a couple of ajax updates to display the remote data a few seconds later.

Of course I want to do this using progressive enhancement in case the Javascript breaks, gets blocked, or isn't supported for whatever reason. My first thought was to use a meta refresh and disable it with javascript, but apparently that's impossible. I'm also violently opposed to the idea of a window.location redirect, because (a) it's highly perceptible, unlike a server redirect, and (b) it's well within the realm of possibility for the JS redirect to work but the ajax to still break (think IE6, ill-behaved mobile devices, etc.)

Is there some way I can build up a page that loads in stages, but still works with plain HTML?

like image 656
Aaronaught Avatar asked Aug 17 '11 19:08

Aaronaught


People also ask

What is an example of progressive enhancement?

Progressive enhancement is used in the front ends of MediaWiki-powered sites such as Wikipedia, as it is readable, navigable, and even editable using the basic HTML interface without styling or scripts, though is enhanced by such. For example, the wikitext editor's toolbar is loaded and operates through JavaScript.

What is progressive enhancement in web design?

Progressive enhancement is a design philosophy that provides a baseline of essential content and functionality to as many users as possible, while delivering the best possible experience only to users of the most modern browsers that can run all the required code.

Which layer of the progressive enhancement uses JavaScript for improved usability?

The third layer is JavaScript. This allows user-agents that are capable of using it to provide your users with enhanced usability.

What is the difference between graceful degradation and progressive enhancement?

Progressive enhancement is a more sophisticated and at the same time stable way of assuring that but it takes more time and effort. Graceful degradation can be used more easily as a patch for an already existing product; it means harder maintenance later on, but requires less initial work.


1 Answers

I've solved this in the past with a couple of approaches: one is to create separate pages for the slow content, so that users who don't have or don't get JS for some reason can click a link to get the content. The experience is different, but works.

Another way to do it is to have a "show" link in the areas that are deferred. JS removes the link and inserts the content. If the user wants to see the content they click the link, triggering a refresh that will not defer the content.

like image 157
ysaw Avatar answered Sep 30 '22 10:09

ysaw