User Guide Cancel

Code samples to build a mobile application

Alert:

All mobile and mobile-related features are removed in ColdFusion (2025 release).

View Deprecated features in ColdFusion for more information.

A simple example

Building mobile applications using the ColdFusion Mobile Platform is easy. Your code will be as simple as:

<cfclient>
<cfset myvar = "Hello World">
<cfoutput>#myvar#</cfoutput>
</cfclient>


Note the new ColdFusion tag, <cfclient> that will be used for mobile development (see The new <cfclient> tag). The ColdFusion content available in the <cfclient> block gets translated into corresponding HTML/JavaScript content.

A more complex example

Let us launch the device camera:

<cfclient>
<cfscript>

function launchCamera()
{
// Capture the image from the device comera
var opt = cfclient.camera.getOptions();
var resp = cfclient.camera.getPicture(opt);
var fileContent = cfclient.file.readFileURIAsBase64(resp);
// Process the image
return;
}

</cfscript>
</cfclient>


Examples

Community posts and tutorials

Get help faster and easier

New user?