Site design - Using script


Skip navigation.

Site search

Site navigation

Site design


Other tutorials

Using script

It is possible to make pages that use scripts extensively, but still remain accessible, and work on the maximum number of browsers. The main rule with scripts is to use them to enhance a page, not to produce content or functionality. If they do produce content, and that content is not available via other means, include <noscript> tags with alternative text or links.

If the script uses features where different browsers have different implementations, don't detect their browser, detect its capabilities and use the appropriate code for their browser. If their browser does not use any of the methods you know, then give them an alternative page, or alternative method of using the content.

When you use scripts, try not to make them unnecessarily large as that adds to the download time. If you are adding a number of MB of scripts to a page, you are probably doing something wrong, and should consider just how much of that script is really needed.

Never use browser specific scripting languages like Microsoft's VBscript. If you can't do it so that it works in every script supporting browser, then you shouldn't be doing it. Use the language they all understand; JavaScript.

If you use script to set the CSS, remember to make the default CSS look good too, just in case their browser does not fall into the categories you define.

If scripts are being used, it can help to use W3C DOM to modify the page after it has loaded instead of dynamically creating content. The page itself can be made accessible, and the script can then add extra interactivity, while leaving the page accessible in less capable browsers.

My JavaScript tutorial has more details.

Last modified: 15 February 2011

  1. Previous
  2. Next
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.