Hello Bubble community!
I’m working on a project where I want to prevent users from opening a particular page in multiple tabs. I have an issue with my current implementation, and I’m looking for a solution or alternative approach.
Here’s what I’ve done so far:
-I created an integer field called "user_count" in the "Room" data type, with a default value of 0.
-I created two custom events, "CheckUserCount" and "IncrementUserCount."
-When the page is loaded, I trigger the "CheckUserCount" custom event, which checks if "user_count >= 1." If it is, the user is redirected to the homepage.
-After the "CheckUserCount" custom event, I trigger the "IncrementUserCount" custom event, which sets "user_count" to 1.
My issue is that “user_count” is set to 1 as soon as the page loads, before the “CheckUserCount” custom event has a chance to evaluate the condition. This causes the user to be redirected to the homepage, even though they have only one tab open.
I’ve tried separating the actions into custom events, but the problem persists.
Can anyone help me find a solution to this issue or suggest a better approach for preventing users from opening the same page in multiple tabs? Any help would be greatly appreciated!
Thank you in advance!