Javascript – Using javascript for pinging a webapp to keep session open


I'm writing a greasemonkey script to keep session open on a webapp I use for work.
Which javascript command would you use to create some feedback with the server and ensure the session doesn't fall without having to bother the user making a complete refresh of the page?

Best Solution

I've solved the issue using:

function keepAlive() {
    var httpRequest = new XMLHttpRequest();'GET', "/restricted_file_url");

setInterval(keepAlive, 840000);  //My session expires at 15 minutes