0

I am creating a Tampermonkey script to use on Upwork.com. It is supposed to reload the job list page every 15 seconds to reveal new entries. The problem is that it will reload the page every millisecond instead. I tried placing setInterval in its own variable, but it did nothing. What am I doing wrong?

var n = 15000;
setInterval(location.reload(), n);
Jon Kantner
  • 593
  • 2
  • 10
  • 29

1 Answers1

2

Because you are calling reload, not setting a reference to it. Use a anonymous function.

setInterval(function () { location.reload(); }, n);
epascarello
  • 204,599
  • 20
  • 195
  • 236