New Perspectives On Web Design

(C. Jardin) #1

CHAPTER 3 The Vanilla Web Diet


What happened? Well, something in the JavaScript went wrong and
took the button with it. javascript:void(0) is not a valid URL and has
no business being in an href attribute. It is a blinking warning sign that
somewhere in the development process Google threw in the towel and
created everything in JavaScript. On investigation, I found out that the pur-
pose of the code is to show an end user license agreement before download
(as hinted in the class name), and the JavaScript automatically detects the
operating system to provide the appropriate install package for Chrome.
Both very good uses for this page, but the way they were implemented
meant Google lost half a day of Chrome downloads.
The remedy is straightforward: instead of pointing the link to a small
inline JavaScript that does nothing at all, it should point to a download
page that lists all the downloadable versions of Chrome. This could be a
great resource in any case, as sometimes I might want to download a ver-
sion not for my OS (for example, if I am on a fast connection somewhere).
You can still add an event handler to the link to do all the other necessary
things done in the JavaScript that was never called.
Redirecting to a EULA page on the server is easy and so is sending
through the information about which OS installer is needed. This was a
classic case of using the wrong tool simply because the developer could.
In essence, it is important to not break the Web with what we do: forms
should be sent to a server-side control; links should point to real resources;
media should be linked to and embedded, instead of just embedded in the
hope that the browser does everything right.
Once we have this, we can add whatever we want. But seriously, trying
to replace the basic transport mechanisms of the Web with our own con-
structs may seem faster but it will always be very prone to error. We have a
working infrastructure — we should use it.
Free download pdf