# Wednesday, 14 December 2011

So here’s the scenario, you have 2 links below. In Internet Explorer 8 and above right click on both of them and check out the difference in behavior.

Link One

What you should see is that for Link One you’re able to see the options you expect to see when right clicking on a link, which is the usual Open In New Window, New Tab, etc. etc. options. But for Link Two you don’t see such options.

This bothered me for quite a while wondering what was causing this problem. Finally after some poking around I figured it out. The HTML for Link One looks like this.

<a href=”http://www.windowsphone.com”>Link One</a>

Nothing out of the ordinary there. Now let’s look at Link Two.

<a href=”http://www.windowsphone.com”><div>Link Two</div></a>

Notice that there’s a DIV tag enclosed in the A tag. And it seems like this causes IE to decide not to show the typical right click on link options. Any element that has a CSS display attribute of BLOCK or INLINE-BLOCK contained in an A tag will cause IE to NOT display the typical link context menus on right click.

Definetly a bug. Doesn’t seem to be anyway around it. So… just remember this behavior and not use BLOCK tags inside A tags. The only other fix for your page is to force compatibility mode I guess, since pressing the compatibility mode button in IE8 fixes the problem. But that just introduces other problems.

Wednesday, 14 December 2011 01:30:41 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  |