isInConsole() for Salesforce Classic

Usage 

Indicates if the softphone is in the Salesforce console.

If this method is used in a Salesforce console where multi-monitor components is turned on, any popped out softphone components are indicated as in the console.

Note

Syntax 

1sforce.interaction.isInConsole(callback:function)

Arguments 

NameTypeDescription
callbackfunctionJavaScript method executed when the API method call is completed.

Sample Code–JavaScript 

1<html>
2<head>
3   <script type="text/javascript" src="http://domain:port/support/api/25.0/interaction.js"></script>
4   <script type="text/javascript">
5       var callback = function (response) {
6           if (response.result) {
7              alert('User is in console.');
8           }
9           else {
10              alert('User is not in console.');
11           }
12        };
13</script>
14</head>
15<body>
16       <button onclick="sforce.interaction.isInConsole(callback);">isInConsole</button>
17</body>
18</html>

Response 

This method is asynchronous. The response is returned in an object passed to a callback method. The response object contains the following fields.

NameTypeDescription
resultbooleantrue if the softphone was in the Salesforce console, false if the softphone wasn’t in the Salesforce console.
errorstringIf the API call was successful, this variable is undefined. If the API call failed, this variable returns an error message.