v2.1.0

Parent Manager Class

Provides methods for managing the parent application window in Bitrix24, including resizing the window, managing scroll, initiating calls, and opening the messenger.
// ... /////
$b24 = await initializeB24Frame()
// ... /////
await $b24.parent.fitWindow()

Methods

closeApplication

async closeApplication(): Promise<void>

Closes the application slider.

fitWindow

async fitWindow(): Promise<any>

Sets the application frame size according to its content size.

resizeWindow

async resizeWindow(width: number, height: number): Promise<void>

Resizes the application frame to the specified width and height.

resizeWindowAuto

async resizeWindowAuto(
    appNode: null | HTMLElement = null,
    minHeight: number = 0,
    minWidth: number = 0
): Promise<void>

Automatically resizes the document.body of the application frame according to its content size.

ParameterTypeDescription
appNodenull|HTMLElementApplication node for height calculation.
minHeightnumberMinimum height.
minWidthnumberMinimum width.

getScrollSize

getScrollSize(): { scrollWidth: number, scrollHeight: number }

Returns the internal dimensions of the application frame.

scrollParentWindow

async scrollParentWindow(scroll: number): Promise<void>

Scrolls the parent window to the specified position.

reloadWindow

async reloadWindow(): Promise<void>

Reloads the application page.

setTitle

async setTitle(title: string): Promise<void>

Sets the application page title — the in-layout heading element (#pagetitle) that Bitrix24 renders around your app. It does not change the browser tab title.

The portal handles this command with BX.ajax.UpdatePageTitle(), which rewrites the #pagetitle element. It never calls BX.ajax.UpdateWindowTitle() (the function that assigns document.title), so the browser tab title stays untouched — regardless of the app's domain or placement mode.

ContextEffect of setTitle()
Application pageUpdates the visible page heading (#pagetitle). Browser tab unchanged.
SliderTargets the layout #pagetitle (often not visible); the slider header and browser tab are unchanged.
Placement (widget)Limited to the host layout's #pagetitle, if present. Browser tab unchanged.

To put a title into the browser tab, open the view as a slider with a bx24_title option (see slider.openSliderAppPage):

await $b24.slider.openSliderAppPage({ bx24_title: 'Q1 2025 — John Smith' })

For full, dynamic control of the browser tab title (e.g. telling apart several standalone browser tabs of your app), the app must own the top-level document — i.e. run as a standalone page outside the portal iframe, where you set document.title yourself.

The im* methods are fire-and-forget

All four methods below post a command to the portal and cannot be told whether it worked. The portal's handlers for them take no callback, so nothing ever answers; the SDK closes each call on its own short timer. Two consequences:

  • the returned promise means the command was posted, not the call started or the chat opened — do not branch on it as a success signal;
  • the action im… stop by timeout line the logger writes afterwards is the normal outcome, not a fault.
Calling any of these prints a deprecation notice in the portal's console, recommending Messenger.startPhoneCall / startVideoCall / openChat. Those are top-window methods and are not reachable from an application — they are not part of a placement's command vocabulary, and the extension the notice names (im.public.iframe) is for an iframe on the portal's own domain, not for an app frame. The notice comes from the portal's own compatibility layer, which the methods below reach anyway; an application cannot avoid it. Tracked in #331.

imCallTo

async imCallTo(userId: number, isVideo: boolean = true): Promise<void>

Initiates a call through internal communication.

ParameterTypeDescription
userIdnumberUser identifier.
isVideobooleantrue for video call, false for audio call.

imPhoneTo

async imPhoneTo(phone: string, params?: Record<string, unknown>): Promise<void>

Makes a call to the specified phone number.

ParameterTypeDescription
phonestringPhone number.
paramsRecord<string, unknown>Extra parameters for the phone manager.

params mirrors the second argument of the portal's own Messenger.startPhoneCall(number, params). The portal does not forward it today — its bridge handler reads only the phone number — so sending it has no effect yet. It is accepted here so that applications need no change on the day the portal starts forwarding it; an unrecognised field is ignored, not rejected.

imOpenMessenger

async imOpenMessenger(dialogId: number|'chat${number}'|'sg${number}'|'imol|${number}'|undefined, messageId?: number): Promise<void>

Opens the messenger window.

ParameterTypeDescription
dialogIdnumber|chat${number}|sg${number}|imol|${number}|undefinedDialog identifier.
messageIdnumberMessage to focus once it opens.

messageId mirrors the second argument of Messenger.openChat(dialogId, messageId) and, like params above, is not forwarded by the portal yet.

imOpenHistory

async imOpenHistory(dialogId: number|'chat${number}'|'imol|${number}'): Promise<void>

Opens the message history window.

ParameterTypeDescription
dialogIdnumber|chat${number}|imol|${number}Dialog identifier.

This one takes a different route inside the portal from the other three: for an ordinary dialogId it ends up in the same place as imOpenMessenger, but for an open-line identifier (imol|…) it takes a separate branch whose public equivalent is openLinesHistory rather than openChat.

Examples

Try call

frame-parent-call.ts
import type { B24Frame } from '@bitrix24/b24jssdk'
import { Text, LoggerFactory, Logger, ConsoleV2Handler, LogLevel } from '@bitrix24/b24jssdk'


const devMode = typeof import.meta !== 'undefined' && (import.meta?.dev || import.meta.env?.DEV)
const $logger = LoggerFactory.createForBrowser('Example:B24FrameParentCall', devMode)
const $b24 = useB24().get() as B24Frame

const loggerForDebugB24 = Logger.create('b24')
const handlerForDebugB24 = new ConsoleV2Handler(LogLevel.DEBUG, { useStyles: true })
loggerForDebugB24.pushHandler(handlerForDebugB24)

$b24.setLogger(loggerForDebugB24)

const response = await $b24.parent.message.send(
  'setTitle',
  {
    title: 'Text for insertion',
    requestId: Text.getUuidRfc4122(),
    isSafely: true,
    safelyTime: 1500
  }
)

$logger.debug('parent response', {
  response
})