0

i am opening a page on the chrome by using F12, and i realize it do have a timer inside the source code, however, the timer started on the page load and it does not store the timer as a variable, what the source code use is

self.setTimeout("OnReload()", 60000);

so if i am intend to using window.clearTimeout(timer);

Since it is not store as a variable, i am not able to using this method to clear the timeout variable, may i ask am i able to clear this timeout???

Ed Heal
  • 59,252
  • 17
  • 87
  • 127
Ryan Shine
  • 442
  • 1
  • 9
  • 23
  • 2
    Perhaps overload the `OnReload` function? – Ed Heal Jan 01 '17 at 11:40
  • I think, the highest voted answer on this SO will help: [http://stackoverflow.com/questions/3141064/how-to-stop-all-timeouts-and-intervals-using-javascript] – Vladimir M Jan 01 '17 at 11:45
  • Ryan - FYI, your comment was removed because swearing is not acceptable on SO. – T.J. Crowder Jan 01 '17 at 11:52
  • @EdHeal: It may be worth posting that as an answer, but starting with "You cannot disable the timer" (since you can't actually do what the OP requests, but your clever workaround is...a clever workaround). – T.J. Crowder Jan 01 '17 at 11:53
  • @T.J.Crowder - Thanks for the complement - not bad with a hangover :-) – Ed Heal Jan 01 '17 at 11:55

2 Answers2

3

As you cannot disable the timer, why not just overload the function i.e.

function OnReload() { }

So that it does nowt.

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
Ed Heal
  • 59,252
  • 17
  • 87
  • 127
0

the answer is i key in self.clearTimeOut(0);

and it work

Ryan Shine
  • 442
  • 1
  • 9
  • 23