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 7061657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:30:03+00:00 2026-05-28T04:30:03+00:00

Apparently many people have run into this problem, but I have yet to be

  • 0

Apparently many people have run into this problem, but I have yet to be able to find a solution that works.

I have a bit of code which needs to run once the page has loaded, and so I stuck it inside the following block:

$(document).ready(function() {
    alert("Running initialization");
    initialize();
});
function checkDivLoaded() {
    if ( $('#footer').length == 0) $.error( 'not ready' );
}
function initialize() {
    try{
        checkDivLoaded();
        ...more code here
    } catch (err) {
        setTimeout(initialize, 200);
    }
}

This works fine in all browsers, with the exception of IE. There, the code does not execute at all.

This code is at the lowest point on the page that I can put it (using the Zend Framework and page-specific ready() functions means that there is a limit to how low on the page it can go). I’ve checked the includes for the js files, which are all being loaded from a local version, and they all have the form

<script type="text/javascript" src=""></script>

Any ideas?

NOTE

When I open the debugger in IE, this starts to work correctly.

  • 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-28T04:30:04+00:00Added an answer on May 28, 2026 at 4:30 am

    I don’t see anything wrong here, but there are just a few things I’d like to point out.

    Before I do that, check IE’s JavaScript console, my guess is an earlier script has an error, and that’s why this one never gets run.

    Instead of $(document).ready(function(){});, you can actually just do $(function(){}). it shouldn’t make a difference, though.

    Also, please don’t pass strings to setTimeout (they get eval‘d in the global scope), pass a function.

    setTimeout(initialize, 200);
    

    Also, are you sure you declared $jquery (shouldn’t it be $.error)?

    <script type="text/javascript">
       $(function() {
           initialize();
       });
       function checkDivLoaded() {
           if ($('#footer').length == 0){
              $jquery.error( 'not ready' );
           }
       }
       function initialize() {
           try{
               checkDivLoaded();
               //...more code here
           } catch (err) {
               setTimeout(initialize, 200);
           }
       }
    </script>
    

    EDIT: If you’re using IE8 or lower, it doesn’t add console unless the debugger is open (I wish whoever thought that was a good idea has been fired). If one of your includes uses console.log it would be undefined, thus stopping all script execution.

    Try adding this to the top of the page:

    window.console = window.console || {log:function(){}};
    

    It will make a “fake” console object, so that console.log will be defined.

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

Sidebar

Related Questions

I'm having an issue that apparently many people have had as well, only what
There are many similar questions, but apparently no perfect match, that's why I'm asking.
My problem is that I'm apparently using too many tasks (threads?) that call a
I recently encountered this problem. I found many instances of people asking the question—
Many websites, including this one, add what are apparently called slugs - descriptive but
Matlab has msgbox, listdlg, textscan, and many other functions that Octave apparently doesn't have.
I have a widget-like block of HTML+JavaScript that people can copy/paste into their HTML-page
I can understand that many years ago there would be this kind of limitation,
CAPTCHAs that ask users to read distorted text are fine for sighted people, but
I am hesitant to ask this question, because it appears as though many people

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.