This page illustrates the action of a JavaScript function, checkAJAX(). It can be called by an HTML page to determine whether the browser supports AJAX and the innerHTML attribute, both of which DIV_SRC requires for its operation. Depending on the result, checkAJAX() can direct the browser to a second page that uses DIV_SRC to present content to the browser, or a third page presents the same content in a format suited to browsers that can't use DIV_SRC.
checkAJAX() is invoked with three or four arguments:
  1. The ID of a DIV or other tag in the document that contains a link to the page that browsers should visit if they don't implement AJAX or the innerHTML attribute.
  2. The URL of the page that the browser should visit if it supports both AJAX and the innerHTML attribute.
  3. The text to appear in the URL if the browser supports both AJAX and innerHTML
  4. If true, checkAJAX() automatically redirects the browser to the first link found in this page. If the browser supports AJAX and innerHTML then this should be the isAJAXurl; otherwise the default link.
If checkAJAX() runs then the browser supports JavaScript; if not then it doesn't. If it does run then it checks to see if any of the functions that implement AJAX are available in the browser. If one is, checkAJAX() attempts to overwrite the link below with a new link to a page that reports success. It does this by assigning a new link to the innerHTML attribute of the ID passed to it. If the browser doesn't support the innerHTML attribute then the link initially supplied will remain visible. If you wish to use this function for your own content, delete the content above the link and customise the URLs and their text to suit your needs.

No AJAX support found, please click here for the next page.