Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed Fluid to make a Facebook app that was essentially the mobile version stacked on a corner (if you know Fluid, you know what I mean) and I feel like there is a feature missing. The ability to refresh the content of the page every X time.

Anyone know how to do that?

share|improve this question

Fluid supports user scripts which are essentially javascript codes to modify the behavior of the website (also styles to modify its looks).

Once you've created you app, right click on the icon in the status bar, and access the user scripts. Create a new one that will target the appropriate url (in my case Facebook.com) and add the following code. Not getting into too much details, but basically it will count for 60 seconds after the last user interaction with the document, to prevent the page from reloading while we are doing something.

var refreshRate    = 600; //<-- In seconds, change to your needs
var lastUserAction = 0;

function resetCounter(){
    lastUserAction = 0;
}

setInterval(function(){
    lastUserAction++;
    if(lastUserAction >= refreshRate){
        window.location.reload();
        lastUserAction = 0;
    }
}, 1000);

document.onkeypress  = resetCounter;
document.onmousemove = resetCounter;

enter image description here

share|improve this answer

I created a updated version of what you are using because in cases on mac I would get the timer reset when I gave the window focused anyway here is my code on JSfuddle.

http://jsfiddle.net/newdark/rGRA3/

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .