# isInConsole() for Salesforce Classic

## Usage

Indicates if the softphone is in the Salesforce console.

:::note
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.
:::

## Syntax

```javascript
sforce.interaction.isInConsole(callback:function)
```

## Arguments

| Name       | Type     | Description                                                       |
| ---------- | -------- | ----------------------------------------------------------------- |
| `callback` | function | JavaScript method executed when the API method call is completed. |

## Sample Code–JavaScript

```javascript
<html>
<head>
   <script type="text/javascript" src="http://domain:port/support/api/25.0/interaction.js"></script>
   <script type="text/javascript">
       var callback = function (response) {
           if (response.result) {
              alert('User is in console.');
           }
           else {
              alert('User is not in console.');
           }
        };
</script>
</head>
<body>
       <button onclick="sforce.interaction.isInConsole(callback);">isInConsole</button>
</body>
</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.

| Name     | Type    | Description                                                                                                                 |
| -------- | ------- | --------------------------------------------------------------------------------------------------------------------------- |
| `result` | boolean | `true` if the softphone was in the Salesforce console, `false` if the softphone wasn’t in the Salesforce console.           |
| `error`  | string  | If the API call was successful, this variable is undefined. If the API call failed, this variable returns an error message. |
