I have this code to refresh a certain div on my site for the chat;
var refreshId = setInterval(function() {
$('#chat_grab').load('chat_grab.php?randval=' + Math.random());
}, 5000);
However if someone leaves a page open, this will loop forever. Is there any way to change it so it times out if the base page hasnt been refreshed in say 10 minutes?