BX24.closeApplication
void BX24.closeApplication();
Method closes an opened modal window with an application (opened via both BX24.openApplication, and via modal window of the embedding location handler CRM_*_LIST_MENU).
It's recommended to use in CRM_*_LIST_MENU, for example, to display closing button. (By default, users do not have any other way to return to CRM, except by closing a pop-up window via criss-cross button in the window's corner.)
Example
The same example for both 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-2024