IE9 and popup windows

I like the new IE9 – but the other day I noticed that the popup windows on one of the sites weren’t resizing properly. Eventually after a lot of head scratching I discovered that the standard way of determining a non-ie browser


if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
} elseif (.....
    //ie browsers use resizeTo

was also catching ie9 in strict mode. So IE9 uses the innerWidth property, but just to make life difficult it’s a READ ONLY property!!!!!!! So the window doesn’t resize.

Rather than try to detect ie9 directly I just put in a quick and dirty check to see if the innerWidth had be changed, if not used the resizeTo method. This worked in ie9 just fine.

Better check all the other browsers I thought – well blow me. Chrome 11 didn’t resize either! Problem there turned out to be that it did change the innerWidth as directed, but that doesn’t resize the window – it uses outerWidth for that.

This was rapidly becoming a mess – so I decided to see what happened if I just used resizeTo for all browsers, and guess what it worked – well sort of. They all resized to pretty much the right size, some a few pixels more or less, but by adding a bit extra (and a margin:auto) they all looked OK.

You can see the result on the Darwoods website, with the pictures on the property detail pages.

This entry was posted in Website Design. Bookmark the permalink.

Leave a Reply