How to Detect if a Tab is Currently Open/Visible?

Is anyone familiar with a way to detect if a current tab is open? For example, I have a ‘Do every 30 seconds workflow’, but I would only like this to occur when the User has the tab open, if possible.

I looked on Stack Overflow and this Page Visibility API was discussed a few times, but I’m not sure if that’s the correct way to approach this in Bubble? (Here is an example of the API working with a video:, where the video will automatically pause when the tab is switched).

This Javascript example also came up a few times, but I’m not sure how to set this up either:

Thank you in advance for any suggestions! :slight_smile:

How about a small demo.
The alert is a bit flaky with fast repetitions, but the workflow event does work.


Ah! Thank you so much, Misha! :slight_smile: This is perfect, and exactly what I was hoping to do. Really appreciate it!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.