[HOME] jsMath (Authors) [Prev][Up][Skip][Next]

Loading jsMath in the Document HEAD

If you use easy/load.js to load jsMath, you can place the SCRIPT tag that loads it anywhere in your document. That is the easiest way to include jsMath in your web page.

The usual way to load jsMath used to be with a SCRIPT tag within the BODY of the document; loading jsMath in the document HEAD used to require additional effort, but as of version 3.0, this is no longer the case. You can now load jsMath in the HEAD and call jsMath.Process() or jsMath.ProcessBeforeShowing() in the document's onLoad handler without ever having any jsMath calls within the BODY of the document. The old jsMath.Setup.Body() call is no longer needed.

The call to jsMath.Setup.Body() is made automatically if jsMath.js is loaded in the body of the document, and if not, the call is made when jsMath.Process() or jsMath.ProcessBeforeShowing() is invoked. This routine is where the styles are set up, the jsMath button appears, the fonts are checked, the missing-font message is displayed, the fallback code is loaded, and so on. Having this performed at the top of the document is a help to your readers, as it will get the file loads started early, and will prevent the style changes from causing the page to change once they have seen it, which can be confusing. So if you load jsMath in the document HEAD, it is still a good idea to put a call to jsMath.Setup.Body() somewhere near the top of the document BODY rather than waiting for jsMath.Process() to do it at the bottom of the page.

Get jsMath at SourceForge.net. Fast, secure and Free Open Source software downloads [HOME] jsMath web pages
Created: 10 Jul 2005
Last modified: 13 Sep 2008 10:15:14
Comments to: dpvc@union.edu
[Next] Adding jsMath to a BLOG or Bulletin-Board System
[Skip] Browser Support for jsMath
[Up] Information for jsMath Authors
[Prev] Dynamic mathematics using jsMath