No! Don’t leave my site …
Today, we are getting more and more requests to convert obsolete, table-based HTML web sites to lean and compliant strict XHTML. One controversial issue (amongst web designers) usually comes up — the use of "_blank" targets.
In the past, blank targets were used to open a new browser window when clicking on outbound links. Well today, that practice is no longer standards-compliant. The reasoning behind this is that targets were introduced to handle frames, which are no longer XHTML-strict compliant. Also, that we as web developers, should not assume the right to open a new window and instead users should have the option by ctrl-click or right click > open in new window. There is a debate amongst developers about the fact that most users are unaware of the ctrl-click feature. The other side reasons that user ignorance is not an excuse and users must learn the tools at their disposal to enhance the web experience. We agree with the latter.
Cubed Monkey’s Stance
We believe in 100% standards-compliancy and agree that browser behaviors should not be forced on the user. We also believe that the average user is evolving and beginning to use the web "properly". When updating a site to XHTML, we — by default — will strip out the target attribute on links and try to educate the client when they inevitably question why outbound links are not opening new windows like their old site once did. They of course assume that this is an error on our end and more often than not demand us to revert. So what are our options?
Option 1: Don’t be so strict!
Change the DOCTYPE to Transitional vs. Strict. Transitional DOCTYPES are intended for use on sites with a lot of legacy code that cannot be easily updated. This is yet another controversial topic that I’d rather not get into here.
Option 2: Cheat with JavaScript
You can add window.open() onClick events to your links. There are other "non-obtrusive" javascript solutions such as with the help of Jquery. The downside to this is that many pop-up blockers will block it and the user must have JavaScript enabled.
Option 3: Just say "NO!"
Hold your ground and refuse to open new windows! Ok, maybe this is not an option, since this topic is NOT a huge deal-breaker as far as accessibility and web standards. We all have bills to pay.
Here’s a compromise: a good way to open new windows without robbing users of the option is to give a hint that the link will open in a new window. This can be achieved simply by adding a tiny icon after the link to suggest that.
In Conclusion
We understand that target attributes are not XHTML compliant and should be avoided. The obstacle comes in educating our clients and users on how to use the web properly. A simple explanation of web standards, usability and ctrl-clicking usually solves the dilemma. When blank targets MUST be used, fall back to a compliant and non-obtrusive solution to solve your problem.









Leave a Comment