Using the Connection APIs

Before you begin, see Connection Functions.

Getting the connection type

<cfclientsettings enableDeviceAPI=true>

<cfclient>

<cfset conType = cfclient.connection.getType()>
<cfset document.getElementById('result').innerHTML=document.getElementById('result').innerHTML+"Type: #conType#"> 

</cfclient>
 
<div id="result"/>

Valid connection types  are Connection.UNKNOWN, Connection.ETHERNET, Connection.WIFI, Connection.CELL_2G, Connection.CELL_3G, Connection.CELL_4G, Connection.CELL, and Connection.NONE.

Finding if the connection is offline

<cfclientsettings enableDeviceAPI=true>

<cfclient>
 
<cfset cfclient.connection.onOffline('callback1')>
 
<cffunction name="callback1" >
<cfset document.getElementById('result').innerHTML=document.getElementById('result').innerHTML+"The mobile connection has been lost">
</cffunction> 

</cfclient>
 
<div id="result"/>

Finding if the connection is online

<cfclientsettings enableDeviceAPI=true>

<cfclient>
 
<cfset #cfclient.connection.onOnline('callback1')#>
 
<cffunction name="callback1" >
<cfset document.getElementById('result').innerHTML=document.getElementById('result').innerHTML+"The mobile connection is active now">
</cffunction> 

</cfclient>

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online