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

Integrating the CPAINT Frontend and Creating the Object

Once your design is complete, the next step is to include the CPAINT frontend classes. This can be achieved by putting the following line of code in the head section of the HTML document. (Of course, you might need to point to a different file location.)

<script src="cpaint2.inc.js" type="text/javascript"></script>

Please note that since CPAINT v2.0 a compressed version of the frontend exists. Its functionality is in every way identical to that of the standard version but all comments and unnecessary whitespace have been removed, reducing it to approx. 50% the size. So if traffic is a concern to you - or you're just being kind - you should use cpaint2.inc.compressed.js instead.

Second, you will need to create an instance of the cpaint object. (Note: This cpaint object is different from the backend class of the same name.) Again, in the head section of your HTML document, add the following lines to create an instance named cp.

<script type="text/javascript">
 <!--
  var cp = new cpaint();
 //-->
</script>

You can also set any configuration options, such as debugging, transfer mode, synchronicity, response type, and connection persistence. (We will get into turning off the CPAINT backend API and proxy connections later.)

By default, here are the CPAINT option defaults: