iframes

LogRocket supports playback of same-domain iframes as part of your session recordings.

In order to view iframe playback within your session recording, you must include a LogRocket.init() call within your iframe code as well as your main application code.

Then, within both LogRocket.init() calls, you must include the option mergeIframes: true:

LogRocket.init(YOUR_APP_ID, {
  mergeIframes: true,
});

See here for more information on the mergeIframes option.

Cross-domain iframes

For security purposes, two additional configuration variables are required to merge cross-domain iframe recordings into their parent windows' recordings.

For the outer window, you must include the childDomains option in the LogRocket.init() call, indicating the origins of all frames embedded in it -- whether they are the same as or different from the origin of that window:

LogRocket.init(YOUR_APP_ID, {
  mergeIframes: true,
  childDomains: ['*'] // OR: ['https://example.child_frame_domain.com', 'https://example.parent_window_domain.com'],
});

Using '*' will include all iframes. When using this option, be aware this may include iframes from third parties that do not expect messages from the LogRocket SDK (no user data will be shared).

In the embedded iframes' code, you must include the parentDomain option in the LogRocket.init() call, indicating the origin of the window in which the iframe is embedded:

LogRocket.init(YOUR_APP_ID, {
  mergeIframes: true,
  parentDomain: 'https://example.parent_window_domain.com',
});

Playback Details

The network requests and logging information from within the iframe will be recorded and shown as normal within the developer pane during session playback.