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

  • Home
  • SEARCH
  • 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 8533433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:57:50+00:00 2026-06-11T09:57:50+00:00

Possible Duplicate: setTimeout Internet Explorer Am I missing something here or is there a

  • 0

Possible Duplicate:
setTimeout Internet Explorer

Am I missing something here or is there a problem in Internet Explorer when passing function parameters to a setTimeout calling the same function?

This will run forever in Internet Explorer:

function myFunction(myParam, tries){
  if (typeof tries == "undefined"){
    tries = 0;
  }
  tries++;
  if (tries < 2){
    setTimeout(myFunction, 50, myParam, tries);
  }
}
myFunction("something");

Is there a way to work around that problem?

http://fiddle.jshell.net/rH3gx/

  • 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-06-11T09:57:51+00:00Added an answer on June 11, 2026 at 9:57 am

    The explanation and solution are in the MDN :

    If you need to pass an argument to your callback function, but need it
    to work in Internet Explorer, which doesn’t support sending additional
    parameters (neither with setTimeout() or setInterval()) you can
    include this IE-specific compatibility code which will enable the
    HTML5 standard parameters passage functionality in that browser for
    both timers just by inserting it at the beginning of your scripts.

    if (document.all && !window.setTimeout.isPolyfill) {
      var __nativeST__ = window.setTimeout;
      window.setTimeout = function (vCallback, nDelay /*, argumentToPass1, argumentToPass2, etc. */) {
        var aArgs = Array.prototype.slice.call(arguments, 2);
        return __nativeST__(vCallback instanceof Function ? function () {
          vCallback.apply(null, aArgs);
        } : vCallback, nDelay);
      };
      window.setTimeout.isPolyfill = true;
    }
    
    if (document.all && !window.setInterval.isPolyfill) {
      var __nativeSI__ = window.setInterval;
      window.setInterval = function (vCallback, nDelay /*, argumentToPass1, argumentToPass2, etc. */) {
        var aArgs = Array.prototype.slice.call(arguments, 2);
        return __nativeSI__(vCallback instanceof Function ? function () {
          vCallback.apply(null, aArgs);
        } : vCallback, nDelay);
      };
      window.setInterval.isPolyfill = true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Javascript closure inside loops - simple practical example Calling setTimeout function within
Possible Duplicate: How to Use setTimeout in a for…loop calling setTimeout with a for
Possible Duplicate: How can I pass a parameter to a setTimeout() callback? Is there
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: Is there ever a good reason to pass a string to setTimeout?
Possible Duplicate: Pass correct “this” context to setTimeout callback? I have a problem with
Possible Duplicate: Nested function parameters and 'this' context in Javascript I'm currently having problems
Possible Duplicate: function in setInterval() executes without delay I am trying to use setTimeOut
Possible Duplicate: Are there constants in Javascript? For example here I set the close
Possible Duplicate: javascript: pause setTimeout(); Im using jQuery and working on a notification system

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.