So in my php authentication library, if someone is not logged in, they are redirected to the home page:
redirect('home/index');
The problem is that I have some modal windows that load content through ajax. If a user somehow is logged out (but still on a page where they're "logged in") then the modal shows the login page since the modal was "redirected" to the home page.
This problem can occur if the user hasn't done anything for a long time (and is logged out), or if they have multiple tabs open and sign out on one of them but on the other try to open a modal popup.
Is there a way to redirect the whole window?