Wednesday, July 26, 2006

Target attribute of Anchor

You can say that I was sleeping in a cave, but it is true that today I have come to know that Target attribute of Anchor is marked as deprecated. Here is more information http://community.postnuke.com/module-Forum-viewtopic-topic-34087.htm on it. Actually this standard is very old and there was no update to IE6 from many years. So IE6 still works with target attribute, however IE 7 completely denies to work with this attribute. Now what is the solution if I want to open a new window from my web page. Well, I was not able to get any cleaner way. Following is the ugly way to do it:
<a href="http://www.microsoft.com/windows/ie/default.mspx" onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;">IE 7</a>

I am not sure how good this solution is. However if you want IE7 to work with your site properly, then you got to do all this. I came to know this when I was adding some new sections like "Links" and "Book I am reading" to my blog. I wanted you guys to get a new window where you can have your own time, but IE7 kept opening the page in same window. Then I started googling and found that I was in cave :)

PS: Above discussion is with respect to IE 7 Beta 3.

No comments: