Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6197671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:51:47+00:00 2026-05-24T03:51:47+00:00

Say someone (evil) has set us a timer with setInterval , but we don’t

  • 0

Say someone (evil) has set us a timer with setInterval, but we don’t know its ID (we don’t have the reference to the object, that setInterval is returning, nor its value)

(function(){
  setInterval(function(){console.log('pwned')},
              10000)
})();

Is there a way, how to clear it? Is it possible to acces the timer some other way? Or at least in particular browser/javascript engine?

David Flanagan touches similar topic his big JSTDG.
setInterval() method, use in malicious code key in the index points to

… Some browsers detect repeated dialog boxes and long-running scripts and give the user
the option to stop them. But malicious code can use methods such as setInterval() to
load the CPU and can also attack your system by allocating lots of memory. There is
no general way that web browsers can prevent this kind of ham-handed attack. In
practice, this is not a common problem on the Web since no one returns to a site that
engages in this kind of scripting abuse!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T03:51:48+00:00Added an answer on May 24, 2026 at 3:51 am

    From quick test, all major browsers (latest Chrome, Firefox and IE) give pretty small numbers as the ID so just looping “blindly” over all possible numbers should work just fine:

    function ClearAllIntervals() {
        for (var i = 1; i < 99999; i++)
            window.clearInterval(i);
    }
    

    Full example:

    window.onload = function() {
        window.setInterval(function() {
            document.getElementById("Tick").innerHTML += "tick<br />";
        }, 1000);
        window.setInterval(function() {
            document.getElementById("Tack").innerHTML += "tack<br />";
        }, 1000);
    };
    
    function ClearAllIntervals() {
        for (var i = 1; i < 99999; i++)
            window.clearInterval(i);
    }
    #Placeholder div { width: 80px; float: left; }
    <button type="button" onclick="ClearAllIntervals();">Clear All</button>
    <div id="Placeholder">
        <div id="Tick"></div>
        <div id="Tack"></div>
    </div>

    This will stop all intervals, can’t stop specific interval without knowing its ID of course.

    As you can test for yourself, it should work on all major browsers mentioned above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say someone purchases something in store and I have set up so the customer
This is minor, I know, but let's say that I have a class Character
In another discussion , someone say something about run the java code on its
Say I have a subdomain xxx.yyy.com running Apache. The files are stored in /home/someone/public_html/xxx
Let's say I have a requirements document in MS Word, and someone else reviews
Let's say I have a table with karma_up and karma_down. Everytime someone votes up
Say someone has an idea for a new, very useful and cool method, for
Let's say that someone has a link to an external image: www.externalsite.com/img/photo.jpg Now, people
Say someone executes the following in a terminal: echo 'start working' > /etc/.example and
Can someone tell me why when I cast a string of say 00332 I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.