Does that code work for you?
Add the code to your website with your IP address in the IP look-up table.
Then warm-up cache by visiting, when you press back you should get a “Are you sure do you wanna leave?” pop-up.
Then visit the site with a non-listed IP address. If the code works, you should not get the “Are you sure do you wanna leave?” pop-up when pressing back.
Only IP address in the list shall get the javascript. But LiteSpeed caches it on-site if triggered on warm-up.
_____
add_custom_js is only being executed there.
Where can I get the demo code?