Category Archives: WHATWG

News related to the Web Hypertext Application Technolgoy Working Group

Conforming target Attribute

One of the biggest annoyances on the web, and something I really hate, is popup windows. It frustrates me, and many others, whenever a site attempts to forcibly open a new window for any reason whatsoever. So, it may be surprising to hear that the target attribute has actually been made conforming in HTML5, even though it was non-conforming in HTML 4.01 Strict, and that this is a good thing. There are in fact several valid reasons for making it conforming, which I will attempt to explain.

When embedding documents within an iframe, it’s important to be able to set the target of links and forms to be the iframe. This is a useful technique for cases where it’s undesirable to refresh the entire page to update a small section. Although there are alternative techniques that could be used, such as the many AJAX solutions, the simplicity of using an iframe can outweigh the cost of using an alternative JavaScript solution.

Similarly, it’s important to be able to cause links within a framed document to be able to set the target to the _parent or _top in order to break out of frames. Without those values, links would default to opening within the frame itself, which is not always useful. When done well, using target in this way can actually be quite beneficial for the usability of a site.

The purpose of _blank value, however, is to cause a link to open within a new window or tab. Although there are many valid arguments against forcing a new window, mostly related to usability and accessibility, the reason for allowing this becomes clear when you consider the alternatives.

There are many authors who, for whatever reason, really want to have links opened in new windows, and nothing will convince them otherwise. But experience has shown over the years that because it is non-conforming in HTML 4.01 Strict, many authors will go to sometimes extreme lengths to get a popup window, while still writing technically valid markup.

Such techniques range from dynamically adding the target attribute to the DOM with script, to using event handlers and calls to window.open(). Such approaches actually ignore the reason for making it non-conforming in the first place, which was presumably to avoid the usability issues, and in fact have chosen to give validity a higher priority.

When a new window is desired, the benefit of using the target attribute over many of the other techniques is that it is actually more beneficial to the user because it is easier to override. Many browsers offer options to cause such links to open in a new tab instead of a window, and some even allow it open in the same tab. While it is also possible to do that with window.open(), doing so can actually interfere with sites that depend upon the new window to function correclty.

Allowing authors to get what they want using the least user-hostile method is significantly better than inadvertently forcing them to find more harmful workarounds. So this is why the target attribute has been made conforming in HTML 5.

A Prevew of HTML 5 on A List Apart

I recently had my first article published on A List Apart entitled A Preview of HTML 5. It discusses the new sectioning elements; and the video and audio elements. I’ve made some working examples for the video element based upon those I gave in the article so you can grab the experimental build of Opera or WebKit nightly and try it out.

Web Jam 3

Web Jam 3 was awesome! I presented a short explanation and demonstration of the video element. For best results, you should use the experimental version of Opera with some support for <video>.

The demonstration video I used was hilarious! I lip synced and danced to the Spice Girls’ hit song Wannabe. You can download it and watch it (Ogg Theora, 14.8MiB). Feel free to remix, share, whatever (my normal copyright licence applies). (If you don’t have a media player that supports Ogg Theora, get VLC or follow the instructions on Wikipedia.)

There were prizes awarded on the night. First prize was Adobe Creative Suite 3 Web Premium and second prize was a ticket to Web Directions South 2007, which were awarded based on SMS voting. There were also several copies of Cubicle Commando awarded randomly to people who had voted for the presentations by SMS.

Earl won the ticket to Web Directions, while I managed to score a copy of Cubicle Commando and also won the Adobe CS3 package! Instead of giving a boring acceptance speech, I ended up giving a live performance of the lip sync dance. Videos of that will be posted somewhere; I’ll let you know when I find out where.

Update: I put the video up on YouTube.