Documentation Index

CPAINT :: Cross-Platform Asynchronous INterface Toolkit

Developer's Guide : Frontend

Frontend Guide: Pages

introduction
integrating CPAINT
working with CPAINT
using the proxy
non-CPAINT data-sources
browser compatibility tests

Browser Compatibility Tests

AJAX is a powerful way to enrich your webpages or to develop complex applications running in your browser. While this is all nice and well there are still users out there on the web with very old browsers which might or might not be able to make use of AJAX and thus, of CPAINT.

So it will be your responsibility to decide what to do if a customer visits your page but is unable to make use of the CPAINT features. Be it because his browser does not support some of the techniques, or because he has deactivated JavaScript.

However we believe that while it is your responsibility to provide a decent fallback in your application, it is CPAINTs responsibility to determine whether CPAINT can be used or not.
So CPAINT (since version 2.0.1) provides a property capable which contains boolean ( true | false ) whether the browser is able to use CPAINT or not.

        <script src="cpaint2.inc.js" type="text/javascript"></script>
        <script type="text/javascript">
          <!--
          var cp = new cpaint();
          if (cp.capable == true) {
            cp.set_response_type('XML');
          }
    
          function trigger() {
            if (cp.capable == true) {
              cp.call('xml_backend.asp', 'get_XML', parser);

            } else {
              alert('your browser does not support the features on this page');
            }
          }
          
          function parser(DOM_struct, XML_source) {
          }
          //-->
        </script>
      

The above example tests the CPAINT-capability before CPAINT is configured or used in the trigger() function. If it fails the test a - very useless - error message is displayed.
While the use of the capable property is completely optional, we highly encourage you to use it in one way or another.

We will gradually improve the tests for CPAINT-capability in later versions of CPAINT as we see fit. Currently Opera, Microsoft Internet Explorer and Gecko based browsers should be able to either pass this test or fail the test gracefully.

However the infamous Netscape 4.x browser family will throw JavaScript errors even on the test. This browser is too old even for the test in its current implementation. We will see to it in an upcoming release if we get reports that a better test is indeed needed.