Does the Core - Tab Blur event use the visibilitychange event for detection? | Community
Skip to main content
February 15, 2023
Question

Does the Core - Tab Blur event use the visibilitychange event for detection?

  • February 15, 2023
  • 1 reply
  • 875 views

We're looking to use the Adobe Client Data Layer - Push to Data Layer action to push collected data before a tab or window is closed. The visibilitychange event from the Page Visibility API behaves exactly as required, with support for task switching on mobile devices. In order to simplify our implementation I'd like to know if the Adobe Core Tab Blur event uses this visibilitychange event to detect when a tab or window has closed? Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

yuhuisg
Community Advisor
Community Advisor
February 15, 2023

According to the extension's source code at https://github.com/adobe/reactor-extension-core/blob/bac916b0ca0c798a205f662cb47c8558e845ed8e/src/lib/events/blur.js#L16 , this event gets triggered by the browser's document "blur" event, which should happen when the current window (or tab) is not the focus in the browser, i.e. not the window/tab that the user is looking at.

This StackOverflow post describes the difference between this "blur" event and "visibilitychange" event: https://stackoverflow.com/q/58148482

rbman001Author
February 15, 2023

Thank you, that's very helpful!

Edit: I initially marked this as the correct answer but having looked at the source code for tabBlur it does in fact use the visibilitychange event https://github.com/adobe/reactor-extension-core/blob/bac916b0ca0c798a205f662cb47c8558e845ed8e/src/lib/events/tabBlur.js#L29

Thanks for pointing me towards the source code though!