Unobtrusive Javascript: a little 'eye for clarity and to impostors

Some scripts, and some Web marketing them use some Javascript functions for non-intrusive (Unobtrusive), even when they are not at all. What makes a script (usually JavaScript) is not intrusive? In principle, a JavaScript script is non-intrusive when you can do without it! Put very simply! When developing a Web site usability of the same should not depend on any kind of script. Only in this case we have a genuine Unobtrusive script.

Javascript scripts intrusive improve or modify existing behavior on a Web page. Libraries as Shadowbox , for example, are really Unobtrusive as in case of their absence does not impede navigation and operation of the Web site if they are always used properly. Unobtrusive Scripts, and often libreirie, although they are actually released by the navigation can sometimes be used so moved, so as to lose their non-intrusiveness!

On this blog, for example, I added a simple function of pseudo-accordion in the sidebar at left. Leveraging libreirie as prototype.js (for the event listener) and Scriptaculous.js (for animation), I have "altered" cards (static) that divide the sections in the sidebar: is simulated by clicking on a sort of opening / closing animated. Eliminado the script, however, this blog is fully accessible and navigable, which makes the script very Unobtrusive:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/ *
** @ Rel.2.0
* /
'dom:loaded' , document. observe ('Sun: loaded',
function () {
) . each ( $ $ ('H2.dropdown'). Each (
element ) { function (element) {
= "pointer" ; element. style. cursor = "pointer";
'click' , element. observe ('click',
event ) { function (event) {
this . next ( ) . style . display == "" ) new Effect. BlindUp ( this . next ( ) , { duration : .5 } ) ; if (this. next (). style. display == "") new Effect. BlindUp (this. next (), {duration: .5});
Effect. BlindDown ( this . next ( ) , { duration : .3 } ) ; Effect else new. BlindDown (this. next (), {duration: .3});
event ) ; Event. Stop (event);
}
)
}
);
}
);

It does nothing but add a new behavior that in itself does not alter the normal airworthiness of this blog. Some, however, confuse the "patches" on page loaded with the concept of Unobtrusive. Some scripts, in fact, can not be "removed" from the structure of a web. Such an action would make the site navigable or - worse - not accessible.

The same Shadowbox, for example, scripts can also be used as intrusive and that, ultimately, is not a choice. For example on the website E-lementi.com I used a series of scripts, Shadowbox and the same, in the intrusive mode, disabling JavaScript in the sense that the website is not navigable! However, do not store these scripts as Unobtrusive.

One Response to "Unobtrusive Javascript: a little 'eye for clarity and to impostors"

  1. July 10, 2008 Text Replacement Techniques in Flash | Undolog.com :

    [...] The accessibility of the site using a True-Unobtrusive Javascript-crawlers and spiders so that they continue to see the page as simple and correctly [...]

Leave a comment

XHTML TAG PERMIT: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre> // blocco generico <code></code> // blocco generico [cc_actionscript][/cc_actionscript] // Actionscript [cc_actionscript3][/cc_actionscript3] // Actionscript 3 [cc_css][/cc_css] // CSS Style Sheet [cc_html][/cc_html] // HTML [cc_js][/cc_js] // Javascript [cc_objc][/cc_objc] // Objective-C [cc_php][/cc_objc] // PHP [cc_sql][/cc_sql] // SQL 


Stop SOPA