isVisible() for Salesforce Classic

Usage 

Returns true if the softphone is visible or false if the softphone is hidden.

Syntax 

1sforce.interaction.isVisible(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('Softphone is visible');
8           } else {
9              alert('Softphone is not visible');
10           }
11        };
12   function isVisible() {
13           sforce.interaction.isVisible(callback);
14   }
15</script>
16</head>
17<body>
18       <button onclick="isVisible();">isVisible</button>
19</body>
20</html>

Response 

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