Evaluating Scripts
Shadi Abou-Zahra, W3C/WAI
Sophia-Antipolis, France
shadi@w3.org
Script Fallback
- 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
Beware: some tools are satisfied with empty NOSCRIPT elements
Script Equivalent
...
<noscript>
<p>YOUR BROWSER DOES NOT SUPPORT JAVASCRIPT!!!</p>
</noscript>
...
Example: Script Fallback 1
Before
<script language="JavaScript" type="text/javascript">
document.write('<table width="' + myWidth '">');
...
After
<table id="fluid" width="100%">
<script language="JavaScript" type="text/javascript">
document.fluid.width = myWidth;
...
Example: Script Fallback 2
Before
<a href="javascript:function()">Link Text</a>
After
<a href="redundant.html" onClick="function()"...
Script Fallback: Approach
- Turn off scripts and use Web site
- Analyze overall script function
- Also consider security aspects
Obsolete Scripts
- 11.1 Use W3C technologies when they are available and appropriate for a task and use the latest versions when supported
Frequently applicable to decoration scripts such as rollover effect
Example: Rollover Script
Before
<a href="page.html" onMouseOut="out(1)"
onMouseOver="over(1)" ...>Link Text</a>
After
<style type="text/css">
a:hover { ... }
</style>
...
<a href="page.html" ...>Link Text</a>
Event Handlers
- 9.3 For scripts, specify logical event handlers rather than device-dependent event handlers
- 6.4 For scripts and applets, ensure that event handlers are input device-independent
Special case: applets and embedded objects with own user interface
Embedded Objects
- 8.1 Make programmatic elements such as scripts and applets directly accessible or compatible with assistive technologies [Priority 1 if functionality is important and not presented elsewhere, otherwise Priority 2]
Problem: difficult to evaluate third-party plugin software
Event Handlers: Approach
- Disconnect mouse and use Web site
- Search for even triggers such as:
- onClick, onMouseOver, ...
Other Checkpoints
- 7.1 Until user agents allow users to control flickering, avoid causing the screen to flicker
- 7.4 Until user agents provide the ability to stop the refresh, do not create periodically auto-refreshing pages
- 7.5 Until user agents provide the ability to stop auto-redirect, do not use markup to redirect pages automatically. Instead, configure the server to perform redirects
- 10.1 Until user agents allow users to turn off spawned windows, do not cause pop-ups or other windows to appear and do not change the current window without informing the user