I just used coffeescript to make this work.
setTimeout (->
setTimeout (->
parent.location.reload true
), 70000
$('#inactivity_modal').modal()
$("#inactivity_modal").bind "hidden", ->
parent.location.reload true
), 540000
In my app a user is automatically logged out at 10 minutes since last request. So, at 9 minutes (54000 milliseconds) this function activates a modal that includes two buttons; one to log out and one to stay logged in. The stay logged in button simply closes the modal and refreshes the parent thereby updating Authlogics last_request_at field and giving the user another 9 minutes until it happens again. Of course, any time a page loads the timer gets reset, therefor any active user wont see the modal. If the user does not respond to the warning modal, Authlogic ends their session one minute later (at 10 minutes) and 10 seconds after that (70000) the parent page is refreshed to conceal any content that may have been visible on the previous page.