There is a useful element NOSCRIPT that can display content based upon JavaScript not being enabled (or not being present if using lynx).
There doesn't appear to be an element to display content based upon JavaScript being enabled, and optionally based upon the version of JavaScript that the user agent supports. Some people get around this by using CSS visibility/display when the server serves up a page, and requiring the onload event to set the div to visible/block.
* What is the feature you are suggesting to help solve it?
I'm not sure on a suitable element name, but a workmate joked it should be YESSCRIPT. I'm completely open to suggestions for the element name and attributes...
eg:
- Code: Select all
<yesscript minver="1.2" maxver="*">
<!--Display super duper JavaScript 1.2 panel that does something cool-->
</yesscript>
* What is the processing model for that feature, including error handling?
The NOSCRIPT element would behave the same as it does currently, so lets forget about that.
User agents not supporting JavaScript, or with JavaScript disabled would need to ignore content inside the YESSCRIPT element.
User agents with JavaScript enabled should look for the optional attributes minver/maxver. If minver is 1.2 and maxver is not present (or an asterisk or something), and the user agent has JavaScript 1.5, then the user agent would render the YESSCRIPT content immediately.
I would think YESSCRIPT would contain block level elements.
* Why do you think browsers would implement this feature?
To make it easier (or more pleasant) for users to experience web sites based upon the JavaScript capabilities of said browsers.
For an example, say you loaded http://www.xhtmlized.com without JavaScript enabled, the (JavaScript dependent) pages/days sliders would not be visible - and this is made possible by an element, not by JavaScript (which isn't enabled in this case anyway).
* Why do you think authors would use this feature?
To support accessible sites supporting JavaScript and script-less operation with the same markup, and no dependency on JavaScript to hide/show content based upon the user agent's JavaScript capabilities.
* What evidence is there that this feature is desparately needed?
These days countries like AU, GB and US have DDA/508 laws requiring accessible sites. I develop an ecommerce application, and based upon the accessibility guidelines such as:
6.3 Ensure that pages are usable when scripts, applets, or other programmatic objects are turned off or not supported. If this is not possible, provide equivalent information on an alternative accessible page. [Priority 1]
we need to ensure that our application is accessible to all regardless of JavaScript being present, and the JavaScript version. Requiring JavaScript to display JavaScript specific controls/panels etc. seems like a workaround - when an element would be more elegant.
I see JavaScript getting more widespread, more governments requiring accessible content and sites paying attention to accessibility. A YESSCRIPT style element would make the lives of developers easier, and hopefully websites more usable to users.
As stated previously, I'm completely open to suggestions on the element name and attribute names. I'm interested in hearing what others think, and if there are any improvements that can be made. If it's a bad idea, or I have completely overlooked something major I'm sure you'll let me know