New Perspectives On Web Design

(C. Jardin) #1

CHAPTER 7 Designing Adaptive Interfaces



  • That third-party JavaScript library we included and which was
    working yesterday has been upgraded and introduced a bug.

  • The user installed a browser add-on that contains an error or crea-
    tes a conflict with our code.

  • The user is still waiting for the page assets to finish downloading
    and our JavaScript can’t execute until they do.


I love JavaScript, but I also realize that it is quite fragile. Unlike writing
code that will execute on our servers, which we control, JavaScript code
is executed in places and on systems that we have no control over and on
which we cannot guarantee its successful execution.
If my JavaScript code fails to execute, I don’t want to be the one getting a
call in the middle of the night because something’s broken. I want the web-
site, Web application, or any other sort of Web thang^12 that I create to be ro-
bust. I want it to keep going like the Chrysler Imperial in a demolition derby^13.
As you saw in the previous lazy loading example, I set up the resting
(a.k.a. JavaScript-less) state so that the necessary information was in place
for the JavaScript to act without
creating problems for users who
did not have JavaScript enabled.
But when JavaScript is available
and my code is executed, the
page is manipulated to create
the best possible experience for
readers.
This approach to JavaScript
is often referred to as unobtru-
sive because it doesn’t get in the
way. On one hand, JavaScript

12 http://www.webthang.co.uk/
13 http://smashed.by/demo-derby

A simple recipe displayed as a tabbed interface.
Free download pdf