My website keeps crashing IE, can't debug

前端 未结 5 1317
北海茫月
北海茫月 2021-01-18 02:09

I have a website that suddenly started to crash internet explorer.

The website loads and starts executing javascript but somewhere in there the machinery explodes. I

相关标签:
5条回答
  • 2021-01-18 02:38

    Make sure that your scripts are running after the DOMReady event occurs. IE is notorious for crashing when modifying the DOM before it is fully loaded.

    In some instances IE might prematurely fire the DOMReady event. See more information on how to overcome this here and here.

    0 讨论(0)
  • 2021-01-18 02:43

    (old question but important one)

    I had a very similar problem - including lots of complex VML (from Raphael), and it looked near-impossible to debug.

    Actually, it turned out the simplest low-tech approach was the best. It's an obvious approach: I'm writing here because sometimes when faced with an intimidating problem the obvious, simple solutions are the last a person thinks of.

    So, simple old-school debugging: Lots of alert("1");, alert("2"); etc before and after every remotely demanding or complex call in my code, giving super-simple reliable breakpoints that don't rely on any features (e.g. developer tools) that might themselves crash out. Then, just see which number alert you get to before it crashes - the problem must arise between that alert and the next one.

    Add more alerts until you narrow it down to the exact line. In my case, it was actually nothing to do with the complex VML - it was a for loop that, for some reason was continuing infinitely only on IE7.

    0 讨论(0)
  • 2021-01-18 02:46

    Are you using JSONP in any form? Popular implementations like jQuery tend to try and clean up memory by deleting the script node from the DOM after it has run. I've seen that crash Internet Explorer in many cases. Never could figure out what other conditions needed to be around to cause that to crash. Too much stuff going on in my other pages.

    Anyhow, if you're using jQuery.getJSON, check the following line in jquery source: (line 5556 on jquery 1.4.3):

     } else {
      // Garbage collect
      window[ jsonp ] = undefined;
    
      try {
       delete window[ jsonp ];
      } catch( jsonpError ) {}
     }
    
     if ( head ) {
      head.removeChild( script );
     }
    

    You can safely remove that, or conditionalize it to only happen in non-IE browsers. Hopefully that helps.

    0 讨论(0)
  • 2021-01-18 02:48

    Its a null pointer dereference non exploitable crash

    0 讨论(0)
  • 2021-01-18 02:49

    Stop using VML?

    If you need stuff in IE that really can't be done by moving, scaling, cropping and replacing images, then consider using Flash, Silverlight or similar.

    If your life depend on VML then read as much as possible about other peoples experience, that may ease the trial and error approach.

    0 讨论(0)
提交回复
热议问题