Expand my Community achievements bar.

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

Avatar

Level 1

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

2 Replies

Avatar

Community Advisor

According to the extension's source code at https://github.com/adobe/reactor-extension-core/blob/bac916b0ca0c798a205f662cb47c8558e845ed8e/src/li... , 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

Avatar

Level 1

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/li...

Thanks for pointing me towards the source code though!