"navigated away" - what do you mean by that?
The proper way to leave an application that require logging in to see restricted information, is to log out (where you can call [man]session_destroy[/man]). If user walks out of a page without it, session data is preserved. You can control for how long a session cookie is kept by the browser with [man]session_set_cookie_params[/man], to make sure that after lets say after 15 minutes of inactivity session is ended.
There is some body onLoad counterpart (onUnload?) in javascript, where you can trigger some action on leaving the page (I've seen something like this done on my online banking page - when you try to leave without logging out - it gives you a msgbox and logs you out, but I didn't checked how it works)