Add auto refresh to user script

1.4k views Asked by At

We have a new web application at work which displays helpdesk calls.

It doesn't refresh automatically, so I wondered about using Firefox and GreaseMonkey to add an auto refresh to the homepage.

I have tried this simple test:

var cells = document.getElementsByTagName('head');
 for (var i = 0; i < 2; i++) {
    cells[i].innerHTML = cells[i].innerHTML.replace('<title>The Home Page</title>', '<title>The Home Page 2</title><meta http-equiv="refresh" content="5" >');
}

It does work, in as much as I can see the page title updates when the script runs, but the page doesn't take any notice of the refresh meta tag.

I guess I am being too simplistic, but wondered if there is any way to add in a way to auto refresh the page in this kind of way?

Thanks

1

There are 1 answers

0
VitaliyG On BEST ANSWER

You can use simpler way

setTimeout(function()
{
  location.reload(true); 
}, 5000)