Posts Tagged ‘ie’

IE bug: text disappearing randomly behind a picture

Wednesday, January 20th, 2010

Even though the text had a high z-index, it would disappear after few seconds behind the picture it’s supposed to be on, or when you switch to another Windows application then come back on the browser.

This erratic behavior turned out to be when IE doesn’t have a Doctype declared.

CakePHP doesn’t define any Doctype by default, so you need to edit your default layout and include it.

In CakePHP 1.1: edit app/views/layout/default.hthml

In CakePHP 1.1: edit app/views/layout/default.ctp

and add:

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

… at the very top, before the html tag.

This happens not even on an old IE6, but on IE8 itself.

IE bug: don’t put extra commas in your JS arrays

Monday, January 18th, 2010

Here’s a simple Javascript array:

var params={
         'uid':uid,
         'comment':'hello',
};

Nothing fancy except that after the ‘hello’ string, there’s an extra comma that should not be there.

Firefox and Chrome don’t care, it still works.

But IE7 hates it, crashes the page and throws and error, with a ludicrous line number in it (did I write that much code?):

Message: Expected identifier, string or number  Line: 225068230

Remove the extra comma and you’re done.

Note that you can see the problem in IE8 also by enabling debugging (hit F12) and set the Document Mode to IE7 Standards.