I lost all my content when the blog got hacked and my hosting company could not restore it. I have subsequently unearthed a heap of old posts (that had sync’d to Facebook as Notes). It’s really interesting (and quite funny) to see what I was busy with so many years ago!
As more and more sites strive for standards-compliant code that passes validation, the developer now faces a conundrum: the once simple process of adding the
_target attribute for links opening in a new browser window or tab will not validate.
You do NOT want a visitor to click away from your site. It took all kinds of wizardry (or hard cash!) to get the user to your site, and now you want to keep him/her there.
The traditional method was to use the
target attribute of the tag, for example:
<a href="www.anotherdomain.com/page.htm" target=”_blank”>Click me</a>
This, however, will not validate as HTML 4.01 Strict or XHTML 1.0 Strict, as the _target attribute is deprecated in both. If like me, you have opted to start coding standards-compliant code, this presents a new challenge: how do I stop my visitors from “clicking away” from my site?
Let’s differentiate between links here:
- Links that form part of your sites navigation
- Links to resources within your site (images, PDF’s, etc)
- Links that lead to external pages or resources
In the case of links in the first class, as you are surely not using frames (!!), there is no real need for these pages to open in a new window or tab – in fact, quite the opposite. As such, they should visually form part of a navigation structure (navigation bar, breadcrumb navigation), thereby implicitly indicating that the link is to another part of the same site. I think users are used to this idea.
I have heard of users setting their browser to open ALL links in a new tab when clicked!
The solution I believe boils down once again to educating the user to either right-clicking on links that do not form part of the site’s navigation, and selecting Open in New Tab, or center-clicking / clicking with the scroll-button on the mouse (if they have one).