Friday, 27 February 2009

Is the NoScript tag the tag of the devil?

I came to the realisation today that the noscript tag is the sporn of the devil. It encourages developers to think of JavaScript in black and white, it's either on or off, the users support it or they don't. Unfortunately this simplistic approach can leave your users frustrated and thinking your site is broken. Consider this over heard conversation...


Project manager:
"Why doesn't the site work on my Blackberry?"
Developer:
"We don't support the Blackberry"
Project manager:
"but I thought you said it works without CSS and JavaScript?"
Developer:
"yes it works fine without CSS and JavaScript, we've built it in semantic HTML"
Project manager:
"so it should work on anything that understands HTML?"
Developer:
"... yes ..."
Project manager:
"so why doesn't it work on the Blackberry??"
Developer: ".... err ....


The NoScript tag has struck, pretty much all user agents support JavaScript. Much better to use progressive enhancement instead.

Consider this:


<noscript>
<p>
Important information for users without JavaScript
</p>
</noscript>
<script type="text/javascript">
if (document.getElementById){
// do funky things
...
}
</script>



We have just created a crack down the back of the sofa which has swallowed every user-agent that supports javascript but doesn't support document.getElementById or doesn't get the JavaScript in the first place. These users don't get the JavaScript enhancement and they don't get the noscript fallback : (

No comments:

Post a Comment

 

Note: the opinions on this page don't represent that of my employer in anyway. And, actually only vaguely represent my opinions on the date of publication. (Unlike Ms T, I am very much for turning)