Documentation

BX24.openApplication

void BX24.openApplication([
    Object parameters[,
    Function closeCallback
    ]
]);

A pop-up window with application will open when this method is called. Parameter data from the 'parameter' will be passed to the application. CloseCallback handler will be called when closing the pop-up window.

Parameters

ParameterDescription
parameters Object with parameters which will be passed to the opened application as a JSON-string
closeCallback Application closing handler

~Is blocked for placements CRM_*_LIST_MENU.

Example

The same example for BX24.openApplication and BX24.closeApplication

<script src="//api.bitrix24.com/api/v1/"></script>
<?
// input data breakdown  
$placementOptions = array();
if(array_key_exists('PLACEMENT_OPTIONS', $_REQUEST))
{
	$placementOptions = json_decode($_REQUEST['PLACEMENT_OPTIONS'], true);
}

// If the app is not deployed, display an open button, if the app is not being closed
if(!isset($placementOptions['opened']))
{
?>
	<span onclick="openApplication()">Open</span>
<?
}
else
{
?>
	<span onclick="closeApplication()">Close</span>
<?
}

?>
<script>
	function openApplication()
	{
		BX24.openApplication(
			{
				'opened': true // data, passed to the opened application
			},
			function()
			{
				// this handler will activate, if the application is closed
				alert('Application closed!')
			}
		);

		setTimeout(closeApplication, 15000); // to close automatically after 15 seconds
	}

	function closeApplication()
	{
		BX24.closeApplication();
	}
</script>


© «Bitrix24», 2001-2022
Up