2

One of my pages (with very extensive javascript) won't load on IE9. It loads ok in Mozilla, Chrome, Safari and Opera.

If IE9 Developer tools are running it loads fine.

If I load IE9, load the developer tools (F12) then kill the developer tools it still loads fine.

If developer tools are running then sometimes (but not always) the first message in the console is:

HTML1113: Document mode restart from Quirks to IE9 Standards 

Doctype is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

If I change doctype to and remove the xmlns nothing changes.

I'm stumped. Any suggestions appreciated.

RoyHB
  • 163
  • 1
  • 10
  • 3
    You have two options. Stop using IE or fix your code. It might also be worth catching up with the rest of the world and stop using XHTML, which has now been abandoned even as a proposed standard. – John Gardeniers Sep 11 '12 at 03:26
  • I 2nd @JohnGardeniers here. It really does sound like your app is treating IE differently than the other browsers. IE9 is fairly compliant with most JavaScript things when compared to Chrome, its just a bit slower at processing it all. Its ok to treat older versions of IE differently, but your app is certainly the cause of whatever problem you are having. – Brent Pabst Sep 11 '12 at 12:12
  • You may want to try compatibility mode in Internet Explorer to see if this resolves the issue. Does it happen load OK on IE8? – needmorebeerformewallaby Sep 11 '12 at 12:09
  • Have you tried reregistering IE? [This article](http://iefaq.info/index.php?action=artikel&cat=52&id=136&artlang=en) has files attached that fix IE8+ on in various combinations of 32/64bit. It's written in German if you want the [auto-translated version](http://translate.google.com/translate?sl=auto&tl=en&hl=en&ie=UTF-8&u=http%3A%2F%2Fiefaq.info%2Findex.php%3Faction%3Dartikel%26cat%3D52%26id%3D136%26artlang%3Dde&act=url) – Chris S Sep 11 '12 at 12:41
  • Sorry, your question is Off-Topic on Server Fault. It would be appropriate on [SO] if you can include the details listed on the [Ask] page. Please see either site's [FAQ] for more details. Thank you! – Chris S Sep 11 '12 at 12:42
  • The problem probably is about "console" logging ou cache. Since here is offtoopic, read here http://stackoverflow.com/questions/7742781/why-javascript-only-works-after-opening-developer-tools-in-ie-once – insign Nov 25 '15 at 17:33

2 Answers2

4

Do you use console object and its methods? IE9 only instantiates it when you open developer tools, and any attempt to index it without checking if it exists will, obviously, fail. Simple workaround is to install empty object and empty stub for most commonly used function - console.log on start of your code.

  • Thanks Oleg - I did use the console object - previously I had tested for it before using but the code that did the testing must have been "Cleaned up" at some point - hence the failure. Your diagnosis is 100% correct. – RoyHB Sep 11 '12 at 15:56
0

See IE9’s Document Modes and JavaScript for info about IE's different document modes. Setting the document mode might fix the problem, but then your web page won't work in early versions of IE. You'll probably need to iteratively narrow down the problem in your JavaScript and modify it to work in IE.

snibbets
  • 131
  • 1
  • 7