Atom Feed

Umbraco modal box and IE8

Jan 14, 2010

EDIT: Jump to the best solution

I recently got a problem when upgrading to IE8.
When I used the right-click menu in Umbraco to create or sort nodes the modal box would not show up, and the yellow "javascript error" sign in the lower left corner would flare up.

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; MathPlayer 2.10d; User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; http://bsalsa.com) ; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; FDM)
Timestamp: Thu, 14 Jan 2010 08:51:36 UTC

Message: Object doesn't support this property or method
Line: 3
Char: 5
Code: 0
URI: /umbraco_client/modal/modal.js

I posted a question about it on the Umbraco forum, and started troubleshooting on my own.

I couldn't see anything wrong with the jqm function call, so I looked in the jqModal part instead. There was a new version of jqModal, so I tried to use the javascript from that version instead, but it was still not working.

After debugging the javascript, I saw several calls to a variable named "ie6". Then I remembered that IE8 has dropped support for som functions in IE6, but still had a very similar browser string. I looked into the variable declaration, and saw that it used an old method of discerning IE6.

Old: ie6=$.browser.msie&&($.browser.version == "6.0") 
New: ie6=$.browser.msie&&($.browser.version == "6.0")&&!window.XMLHttpRequest 

I thought this would solve my problems, but the issue was still there.
From my other projects I have encountered errors with javascript using functions that has not been loaded yet.

So I split the modal.js file into modal.js and modalhelpers.js, the former containing the jqModal script and the latter containing the Umbraco helper functions. I edited /umbraco/umbraco.aspx to load modal.js before loading modalhelpers.js, and voila! It worked!

EDIT: (The best solution IMHO)
Another fast fix is to insert the following code into /umbraco/umbraco.aspx:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

I hope this will be fixed in the next Umbraco release, but for those in need of an immediate fix, try one of the above.