Thursday, February 21, 2008
Thursday, February 21, 2008    

I have been developing a business site for someone and being a developer and a designer, I wanted to do something clever. So I decided to use some AJAX for one of the pages that has several sections... essentially like loading HTML pages into an IFrame on the page... taking 6 pages and turning it into one. I thought it was cool, the end user probably could not care less. "Hey, look, the content is changing but the URL is staying the same!" -- ya, only a geek would appreciate that most likely.

But I took it further because I have global navigation in a server-side include that has links to all those subpages too... so I mistakenly decided to use different anchor tags for the same URL, and read the

document.location.hash
value with javascript and load the appropriate content into the AJAX container. And this worked well (ignoring the bastardization of the anchor tag). However if you were already on that one URL and used navigation to visit again, there would be no body onLoad to fire, so I changed my javascript to look for a hash and also the value of a param sent in from the navigation, etc. Everything was working pretty well, but all of this was hanging on javascript.

I was trying to be clever and have some fun with things by forcing this technology on the site. The javascript itself felt like building a house atop of lot of toothpicks. It might work for a while, but the whole thing was architected in a fragile manner. If someone visited having turned off javascript, the site would be broken as well.

In the end, I ripped out all the javascript and simply turned the thing into 6 distinct pages. Its not as cool as it was before, but its incredibly stable now and doesn't require javascript magic to enable it. I wasted a lot of time getting that thing to work (mostly), but I am certainly glad that I knew that it was time to throw in the towel and go old-school on it.


0 Comments:

Post comment

Links to this post:


Create a Link

gotoAndStop( topOfPage );