a tags and xhtml strict

For those of you out there who are trying to keep up with web coding standards may have noticed the ‘target’ attribute for the anchor (a) tag is not supported in xhtml strict. Now I do realize that xhtml has been a standard for some time now (2000ish), but it has only been a few months now that I have been trying to do all of my markup according to the strict standard. Before that (and ever since I knew what a DocType was) I just tried to write my code transitional compliant.

Anyway I guess they have depreciated the ‘target’ attribute (unless you are using frameset) with the idea that the World Wide Web Community has matured to the point that individual users should be able to direct the loading of hyperlinks to the window of their choice (i.e. new tabs, new windows, etc.).

I however, when I realized that the ‘target’ attribute would not validate, I decided to find a way to pull off opening a link in a new window that would not break pages.

Here is what I came up with:

<a href="go.html" onclick="return !window.open(this.href);">Click Me</a>

It requires JavaScript to work but it degrades just fine. If the popup works it will return true and then cause the onclick event to return false and stop the current window from loading the ‘href’. If the popup window fails but JavaScript is enabled on the browser (i.e. the window.open gets stopped by a popup blocker) it will return false and the onclick event will come back true and the page will be loaded into the current window as if the popup was never attempted. And finally if JavaScript is disabled the link will just function normally.

Way to go Microsoft Internet Explorer 7

This may be one of the very few times that I will ever praise Microsoft for their work in the web browser industry. And quite honestly I am only praising them out of the fact that they are finally fixing one of Internet Explorer’s most abused bugs (i.e. It would have been truly better if they didn’t have the bug in the first place).

I am talking about the Star-HTML hack (I apologize for not having a better reference article) in Internet Explorer. Which is where you can add a ‘*’ in front of your CSS selector inside of a style tag and it will only be applied in Internet Explorer.

<style type="text/css">
  /* Will only be rendered in IE */
  * html {
    border: none;
    height: 100%;
    margin: 0px;
    padding: 0px;
    width: 100%;
  }
</style>

Apparently Internet Explorer 7 has corrected this issue so that it ignores the syntactically bad code just like most other browsers. Which I would say is a good thing. However there is a bit of an uproar brewing about it being removed because so many developers have come to rely on it to get their webpages to look right in both IE and Non-IE browsers.

Personally I welcome the fix and think that people who have relied on a hack composed of syntaxtically incorrect code should not be surprised that it has finally caught up with them. Even Microsoft gets around to fixing its bugs from time to time. Personally, I don’t understand why anyone writes syntactically bad code to target IE when you can use conditional comments (which have been around since IE 5) to add specialized styles, extra Javascript, ActiveX components, etc.

However in all fairness Internet Explorer 6 was released almost two years ago (August 6, 2004), which is a tremendous amount of time when it comes to the web (which is part of the reason why IE is so insecure and has such standards compliance problems; it is very outdated in comparison to other browsers). So I can understand that many developers have come to rely on certain things to be a constant and may have many pages to fix.

Internet Explorer 7 also boasts what seems to be a decent jump up in standards compliance. It is hard for me to say specifically what has improved; I have just noticed that when I layout pages, IE 7 beta 2 renders them a lot closer to Firefox, Opera and Konqueror without custom styles.

Another thing that I am glad that Microsoft is finally fixing in their browser is the support for PNG (Portable Network Graphic) transparency. However I am by no means applauding them on this effort because many other browser have had full support for quite some time and the format has been standardized since October 1996. I am just glad that once the browser is released and in time I will finally be able to leave behind GIF’s (a graphic format from the late 1980’s) and stop doing DOM based workarounds.

This is a poll that is going on about the Star-HTML hack. If you understand the concept I encourage you to vote (if you have not already).
http://www.positioniseverything.net/articles/poll/star-html.php

Fun with browser bugs

About a week or so ago I came across this blog put together by a fairly well known internet security guru that is currently exposing one browser security bug for every day of this month (July 2006). He is providing proof of concept code to illustrate the errors/vulnerabilities but is not providing the means to exploit them (you have to figure that out for yourself).

Not surprisingly Microsoft’s Internet Explorer has already managed to sneak itself on there ten out of twelve days so far. Many of these bugs Microsoft has already been aware of (since March) and has yet to do anything about it. This is a great example why you should switch to any browser other than Internet Explorer.

The other two browsers mentioned thusfar are Mozilla Firefox and Apple’s Safari. However Firefox’s bug has already been fixed and released in its latest version.

It will be interesting to see how the bug count turns out, browser to browser. It has been reported that he has issues for many browsers including Internet Explorer, Firefox, Safari, Opera and Konqueror. I get the feeling that the results might come out just a little one-sided.

Here is the link to the blog where the code is being posted:
http://browserfun.blogspot.com/

{
}