I don’t understand this at all. Here is some Javascript code that works in every browser, but IE 9. It is called from a Flash movie using ExternalInterface and is designed to dynamically resize a movie in the DOM if the movie resizes inside
function vResizeFlash(swfId, ht) { document.getElementById(swfId).height = "100%"; document.getElementById('flashContainer').style.height = ht + "px"; }
But it works fine if I modify document.title:
function vResizeFlash(swfId, ht) {
Here I just crop any white space on the right side of document.title , and then add one space character to it. The following lines are suddenly executed. Note. There are other ExternalInterface calls on the page, and they all work fine, even in IE 9, so this is not a Flash / IE 9 problem.
I came across a fix because I changed the title to show the arguments of the function (as a quick debugging test) to make sure the function starts. And suddenly the code worked. Take it out? Does not work. 100% reproducible.
Does anyone know why this absolutely intoxicating behavior occurs?
UPDATE
@ c69 posed the question: "Maybe its IE9 with remote code?"
I did not know about this, so I went and went to Google and found this article on this topic, as well as a discussion elsewhere. I don’t know enough about this to evaluate how this will affect the two-line Javascript function, especially since one of the lines has a reference on the page (although this is a late load through SwfObject code). However, it would be a good mistake for the code “optimizer” to delete lines of code that he considered unnecessary because he does not understand how they are called. And if he did not understand how the lines are called, how does inserting a line creating dummy changes in document.title render this code suddenly “necessary”?
UPDATE 2
Another piece of the puzzle. This may have something to do with IE 9 compatibility mode. The page starts in IE 9 standards mode.

Now, if I turn on IE compatibility mode,

the problem disappears without using the above hack. Turn it off, and the problem will return (if there is no hacking).
But when I tried to do a simple test using the same HTML (minus a few JSP tags) and devoid of SWF, which only contains resizing code and testing tools, everything worked fine. However, in this case, the compatibility icon is not displayed at all.

We are using Tomcat 6.0.32. I don’t know that we use special headers and there are no meta tags regarding IE compatibility mode (in the main application or in the test application).