Arshad Tanveer just commented on my post Well Designed URLs are Beautiful! Arshad felt I was being "a tad too harsh on links triggering JavaScript." Well he was right; I was being harsh. But I was being harsh on purpose!
My reason for being harsh on using JavaScript instead of basic HTML hypertext was to make a strong point, and to have that point stand out among my other points. Yes, there are a few good reasons to use JavaScript to load another URLs content into the browser, but I would argue:
- Good reasons for using JavaScript in an <A> tag are few and far between, and
- The cases where there are good reasons can be eliminated by changing architecture, and will probably result in a better overall design.
That said, I’d like to offer this challenge to JavaScript devotes: Give me what you think are good uses of JavaScript triggering URLs, and I’ll do my best to I’ll explain how and/or why it would be better without JavaScript!
P.S. If you can provide website examples with URLs and or developer tools that use them, it will help me and my readers better understand the example.
As a former MapQuest user, I find Google Map’s interactive interface built with AJAX (a combination of Asynchronous JavaScript and XML) really cool and lots of fun to use. And Google’s GMail, also built with AJAX, has a nice snappy UI that’s much better than Hotmail. And the more websites that adopt AJAX techniques the less stodgy and more fun the web will be.
But even so, I still think this Next Big Thing called AJAX could well turn out to be a disaster for the web (disaster with a lower case "d," that is.)
Why? The simple answer is "state", or lack there-of.
In the early days for the web, a Uniform Resource Locator pointed to a page on the web that stayed the same, at least until updated. Later, many URLs pointed to dynamic content, but most returned deterministic content; i.e. they returned the same HTML even if accessed multiple times. However web pages with AJAX content have an infinite potential number of states, many for which no URL will ever exist.
Why is this bad? Let me use examples. Have you ever tried to email a friend a Google Map at the precise zoom level you are viewing? Fortunately Google makes it possible with the "Email" link, but how many other web developers will go to that level of effort?
As another example, try using GMail. Click around a bit. Now click the refresh button. Shazam! The page view you had disappears and you return to the Inbox. Now click the [Back] button. Do you go to the state where you were previously? No! You go back to the prior web page, whatever that was. You cannot go "back" to the prior page in an AJAX site because the browser doesn’t manage the state for you. Instead the AJAX developer has to manage state and provide a "Back" link or you won’t be able to go back. So what’s the likelihood when he’s behind schedule to release a new website he’ll go to that extra effort, or even that he’ll know how?
Okay, these are just nits from someone resistant to change, right? Well, not exactly. The biggest problem with lack of state is that programs, such search engines, can’t process AJAX web pages programmatically; Google, for example. Anything hidden behind AJAX’s interactivity is also hidden from search engine view.
In the July 4th, 2005 issue of Information Week, Google’s own Bret Taylor claims clicking on a blue URL and loading a page is "the old Web User interface." Ironic that the company that spawned interest in AJAX is the one that depends most on the programmatically indexed web pages that AJAX will minimize.