Site Navigation

Friday, November 30, 2007

bug 111 - IE Broke The Web 2.0

Issue: #101
Affects: IE5, IE5.5, IE6
Trackers:
MSKB Tracker: 177378
Fixed in: IE7

The most significant part of Web 2.0, was the ability to put more relevant content on the screen for a user. It could be a Gmail popup with a users' avatar, or a DHTML inline popup calendar, an AJAX based "lightbox", or the coolest form widgets we've ever seen, etc.

Almost any "Web 2.0" site/application uses some level of floating elements... but unless you only support IE >= 7, doing this requires an intimate knowledge of IE's worst rendering bug ever.

No matter what CSS z-index you set, you can't float an element (like a div) over a select list!

Example:

<style type="text/css">
#item_1 {
left: 75px;
position: absolute;
top: 75px;
z-index: 0;
}
#item_2 {
background-color: #efefef;
border: 1px solid #0000ff;
display: block;
height: 200px;
left: 100px;
position: absolute;
top: 100px;
width: 300px;
z-index: 9999;
}
#item_3 {
left: 150px;
position: absolute;
top: 150px;
z-index: 10;
}
</style>
<select id="item_1">
<option value="4">Always Renders Through!</option>
</select>
<div id="item_2">This should float over anything!</div>
<select id="item_3">
<option value="7">Always Renders Through!</option>
</select>





This should float over anything!





Known Workarounds: Three ugly hacks.
1.) Hope that a select will never appear under your floating elements. (a.k.a. Ostrich with head in the sand technique)
2.) Hide select lists, whenever showing a floating element (very quirky behavior for the end user)
3.) Float an iframe (with nothing in it) over the area first, then float the element

Option 1 only works if you can 100% guarantee that nothing will overlap your select lists (e.g. not likely). Option 2 works, but looks horrible, thus leaving Option 3 as the only reasonable workaround... and yes, it requires the most work of the 3 options.

Example Workaround Code:

<coming soon...>



Related Issues: None.

Monday, November 19, 2007

bug 169 - browsers parse 10 digit numbers as IP addresses

Issue: #169
Affects: IE6, IE7, Firefox
Status: [By Design]

At first this appears to be a "feature", but when the consequences of this bug are thought through, it is just one more vector of attack for unwitting surfers to fall prey to.

If you click on the following link (the href is the same as the text you see), it will take you to a web site!

http://1208929639/

Looks familiar?

The trick is, an "evil" site will look just the same:
http://3493960174/

First off, what are these urls? Well, if you take the IPv4 address of any domain, and convert each octet to hex, concatenate the hex value, then convert back to decimal, you'll get a 10 digit number.

As it turns out, IE & Firefox will handle this 10 digit number, resolve the IP Address, and navigate to it.

e.g. This blog post can be accessed by this URL (only in IE!)
bug 169 - browsers parses 10 digit decimal numbers as IP addresses


What this means, is that phishing scams, and any site that wants to lure you into downloading malicious software, now has yet another way to do so. It also means that any spam filtering software, or blacklisting software needs to handle roughly double the ammount of URLs in order to protect users!

(currently running tests on various browsers to determine the number affected)

Example:

//tracert www.youtube.com
// => 208.65.153.238
// => Hex
// D0.41.99.EE
// D04199EE => Decimal
// => 3493960174
//<a href="http://3493960174/watch?v=qItugh-fFgg">Fake Label</a>


Try it here:
Best game ever!


Known Workarounds:
No workaround required. This feature is by design and does not realistically increase the attack surface.


Related Issues: None.

Thursday, November 15, 2007

bug 171 - dynamic table DOM gotcha in IE

Issue: #171
Affects: IE6, IE7, IE8

When HTML first came out, the HTML Table was a simple element consisting of a <table> tag, with n <tr> tags, each with n <th> or <td> tags in it.

The specification grew, to include a tag called <tbody> (among others) to help group sets of rows within a table.

Browsers allowed for both implementations, either with the optional tbody section or not.

However Internet Explorer did something strange... they actually started to follow the spec (even though they miss the mark almost everywhere else).

In IE using the DOM, if you try to add <tr> elements to a <table> using the .appendChild() method, you MUST add a <tbody> section first. IE will not throw any errors if you do not, but it will also not render any rows/cells in your table either.


Known Workarounds: One. Always add the tbody section, and be sure to expect it when navigating this table in the DOM later on.


Related Issues: None.

Wednesday, November 14, 2007

bug 280 - lack of events for options

Issue: #280
Affects: IE5, IE5.5, IE6, IE7, IE8, IE9 PP4, IE9 RC 1, Opera, Safari 3, Safari 4 Beta, Chrome v1, ?
Partially Fixed in: Opera 9.5-9.64 (onclick, onmouseover, onmouseout, onmousedown, onmouseup fixed!)
Partially Fixed in: Safari 4.0 (onclick, onmouseover, onmouseout, onmousedown, onmouseup fixed!)
Partially Fixed in: Chrome 2.0 (onclick, onmouseover, onmouseout, onmousedown, onmouseup fixed!)


The option element is used inside a select element to provide options for the user to select from. Like all visually displayed elements in the browser, you can attach event handlers to them too.

Well, not quite. The following table indicates the level of support for each browser, and event.












EventFirefoxInternet
Explorer
KonquerorOperaSafariChrome
onclickYesNo?YesNo (v4.0 Yes!)No (v2.0 yes!)
onmouseoverYesNo?No (v9.5 Yes!)No (v4.0 Yes!)No (v2.0 yes!)
onmouseoutYesNo?No (v9.5 Yes!)No (v4.0 Yes!)No (v2.0 yes!)
onmousedownYesNo?No (v9.64 Yes!)No (v4.0 Yes!)No (v2.0 yes!)
onmouseupYesNo?No (v9.64 Yes!)No (v4.0 Yes!)No (v2.0 yes!)
keyupNoNo?NoNoNo
keydownNoNo?NoNoNo
keypressNoNo?NoNoNo


Only Firefox seems to support the full array of mouse events, Opera is next supporting an onclick event, but in IE and Safari(win) there is no support for mouse events on options.

Oddly enough, no browser seems to support keyboard events on options.

View the following samples in Firefox, Safari or Opera and IE.

Example:






Known Workarounds: None.

Related Issues: bug 291.

Sunday, November 11, 2007

bug 208 - onload event fires for every frame of an animated GIF

Issue: #208
Affects: IE5, IE5.5, IE6, IE7
Fixed In: IE8

The onload event can be attached to a window, frame or image element and will fire when the element has fully loaded. However in IE, if you attach this event to an animaged GIF image, it will fire for EVERY frame in the animation!

Example:

<img src="waiting.gif" onload="waitLoaded();"/>


If you load this in IE, with an animated GIF, it will continuously execute the waitLoaded() event handler until the user presses Escape/Stop.


Known Workarounds: One.
The only workaround for this, is to immediately nullify the event handler after it has fired the first time.

Example Workaround Code:

<img src="waiting.gif" onload="waitLoaded();this.onload=null;"/>



Related Issues: None.

Friday, November 9, 2007

bug 293 - can't disable options in IE

Issue: #293
Affects: IE5, IE5.5, IE6, IE7, IE8, IE9 PP4
Partially Fixed in: IE8 Partner Release 1

MSIE Feedback ID: 336685

Yet another issue with select lists in IE. First you couldn't style them (bug 291) then it turns out, you can't disable them either!

Example:

<select>
<option>I am valid</option>
<option>I am valid too</option>
<option disabled="disabled">I am NOT valid</option>
<option>I am also valid</option>
</select>


Try it for yourself, load this page up in IE and any other browser.


Update: IE8 partially fixed this in that you can disable options and thus they render grayed out and can't be selected by mouse - however they can still be selected by alphabetic key presses. (e.g. in the sample above, press "i" until you see that you've selected the disabled option)


Known Workarounds: None.


Related Issues: bug 291.

bug 317 - onload doesn't work everywhere

Issue: #317
Affects: Firefox, IE6, IE7, Opera, Safari

According to the JavaScript documentation, the onload event can be handled for the body, iframe, img, frameset & object tags. However not all browsers obey this the same.

Supports iframe onload:
Firefox - Yes
IE6, IE7 - Yes
Opera - Yes

Safari - No

Supports object onload:
Firefox - No
IE6, IE7 - No
Opera - No
Safari - Yes

So, take this into consideration if you are planning to use object versus an iframe in your next project.


Known Workarounds: None.

Related Issues: None.

bug 291 - no styling options in IE and only some in Safari

Issue: #291
Affects: IE5, IE5.5, IE6, IE7, IE8, IE9 PP4, Safari 3, Safari 4

CSS was meant to be the solution to applying global styling, without interfering with the content of a page. For the most part, it works really well, although IE has been very slow to catch up to the other major browsers in this arena.

Case in point. The option element is used inside a select element to provide options for the user to select from. In IE, you can style it any way you want, as long as all you want to style is the font and the color... because all other styling options just won't work!

View the following samples in Firefox, Safari or Opera and they will work like a charm*. In IE the colors work, but after that, it just ignore the styling requests.

Example:


Note: In Safari the background colors do work, but the background images and padding do not.


Known Workarounds: None.

Related Issues: None.

bug 146 - IE caches your AJAX

Issue: #146
Affects: IE6, IE7

So, you're doing all kinds of funky stuff with AJAX now, and you've come to notice in your testing that sometimes Internet Explorer is not really hitting your server, but instead caching your AJAX calls?! Even if you set the no-cache header!

Addendum:
As Eric Lawrence points out over on his site Enhance IE, this bug (#IE0001) is only a "bug" when IE caches and a query string is present; The HTTP standard does not prohibit caching if a query-less GET returns no cache indicators.

Known Workarounds: Two. If you are calling a particular request repetitively, but are expecting different results, add a unique parameter to the request.


Example Workaround Code:

<script>
var url = 'http://www.example.com/dir/foo?param1=a¶m2=b';
//add a unique param to the request (adjust to suit)
url += '&guid=' + new Date().getTime();
</script>




Known Workaround: Second Option.
Set the full cache header information, not just the no-cache.


Example Workaround Code:

<!-- This example is using PHP -->
<?php
header("Pragma: no-cache");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Cache-Control: no-store, no-cache, must-revalidate");
?>





Related Issues: None.

Tuesday, November 6, 2007

bug 299 - setAttribute "checked" does not work in IE

Issue: #299
Affects: IE5, IE5.5, IE6, IE7
Fixed In: IE8 RC1

If you use the DOM Methods to build up new content for your page, be aware that in IE, you can't pre-check a radio button or a checkbox using .setAttribute('checked', 'checked'); or even myCheckBoxObject.checked = true; *unless* you add the element to the page first.

Example:

<script type="text/javascript">
var cb1 = document.createElement('input');
cb1.setAttribute('checked', 'checked');
document.getElementsByTagName('body')[0].appendChild( cb1 );
</script>


In all other browsers, this would add the checkbox to the page, pre-checked.

Known Workarounds: Two. You can set the checked attribute after you've appended your element to the DOM (so it will flash momentarily before being checked), or, you can call cbObj.setAttribute('defaultChecked', 'defaultChecked'); which will also work.

Note, when setting the checked, or the defaultChecked attribute, any value for "true" will work.

Example Workaround Code:

<script type="text/javascript">
var cb1 = document.createElement('input');
cb1.setAttribute('defaultChecked', 'defaultChecked');
document.getElementsByTagName('body')[0].appendChild( cb1 );
</script>


Related Issues: bug 235, bug 237, bug 242.

bug 193 - onchange does not fire properly on IE radio buttons and checkboxes

Issue: #193
Affects: IE5, IE5.5, IE6, IE7, IE8, IE9 PP4
Fixed in: IE9 RC 1 (in IE9 standards mode only)

The onchange event can be attached (inline or as an event handler) to any form element. It fires whenever the value of the form field changes. Unfortunately, the behavior is a bit strange in IE, in that for a checkbox, or a radio button field, the event doesn't fire when it is supposed to (right when you click the option you want to choose), but instead it only fires, when you click elsewhere on the page/form, or if you explicitly call blur(); on the field.

Example:

<input type="radio" name="foo" value="Green" onchange="alert(this.value);"/>Green<br/>
<input type="radio" name="foo" value="Blue" onchange="alert(this.value);"/>Blue


As soon as you click on either of these radio buttons, the alert should pop up telling you what you just selected.

Try it out!

Green

Blue

You'll notice that it works just fine in all browsers except Internet Explorer. In fact, in IE, clicking once will not pop up the alert, but clicking the other radio button will pop up the alert, but the value is the last radio button clicked.


Known Workarounds: One. Instead of using the onchange event, use the onclick event for radio and checkbox elements instead (or at least for IE)

Example Workaround Code:

<input type="radio" name="foo" value="Green" onclick="alert(this.value);"/>Green<br/>
<input type="radio" name="foo" value="Blue" onclick="alert(this.value);"/>Blue


Test this version with onclick:
Green

Blue


Related Issues: None.

Friday, November 2, 2007

bug 287 - can't float over an iframe in Konqueror

Issue: #287
Affects: Konqueror 3.5.4
Status: [Fixed!]
Fixed in: Konqueror 4.0

Advanced web sites and applications these days tend to "float" content above the document window to provide dynamic tooltips, calendars, option lists, lightbox effects for image galleries etc.

In order to be able to do this, an element must be "floated" above the rest of the page, often with a higher z-index value to ensure it stays above all other elements.

In Konqueror however, you can't float elements above an iframe, regardless what the z-index is set to. The only exception is that you can float another iframe, over an iframe. See KDE Bug ID:141615.

Example:

<style>
#myFloaterDiv {
position: absolute;
width: 200px;
height: 200px;
top: 100px;
left: 100px;
z-index: 1000;
}
#myIframe {
position: absolute;
width: 300px;
height: 300px;
top: 200px;
left: 200px;
}
</style>
<div id="myFloaterDiv">
Floating above
This should be above the iframe.
</div>
<iframe id="myIframe" src="http://www.digg.com/">
</iframe>



Known Workarounds: None.

Related Issues: None.

Thursday, November 1, 2007

bug 184 - The catch to Try Catch Finally in IE

Issue: #184
Affects: IE5, IE5.5, IE6, IE7
Fixed In: IE8 RC1


Like several programming languages, JavaScript offers the try/catch/finally block. This allows for errors to be handled gracefully, rather than halting the page execution.

You place code that might cause an error in the try section. If an error occurs, the catch section will allow you to handle it, and the finally block is always executed regardless if an error occurred or not.

The finally part is optional, as is the catch part. (wikipedia reference)

However, in IE, if you don't supply a catch statement, your finally statement will never be called!

Example:

<script type="text/javascript">
//this works
try {
window.undefinedMethod();
} catch(e){
alert('Error: ' + e);
} finally {
alert('about to print...');
window.print();
}

//this fails in IE
try {
window.undefinedMethod();
} finally {
alert('about to print...' +
'\nBut IE will never show this message' +
'\nNor will it call print()');
window.print();
}
</script>



Known Workarounds: One. Although the catch is supposed to be optional, to make IE work properly include an empty catch.

Example Workaround Code:

<script type="text/javascript">
try {
window.undefinedMethod();
} catch(e){
//ensure IE executes the finally section
} finally {
alert('about to print...' +
'\nIE will show this message' +
'\nand it will call print()');
window.print();
}
</script>



Related Issues: None.