Opening a link in a new window
Posted Jun 29, 2005 at 12:16 PM
XHTML 1.0 Strict has deprecated the target attribute for opening links in new windows.
So, here are the options available to us:
- Use a traditional link that does not open a new window. Users will love you for it.
- Use a link with an onclick event attribute instead. There are a few issues with this approach:
- There is no href defined, so styles only specificying
aas their CSS selector won’t apply. - Users with script disabled or without script support cannot navigate to the destination.
- There is no href defined, so styles only specificying
- Use a modified link with both an href and an onclick event attribute. This way, users get to navigate regardless of their script support or enabled state.
If desired, you can also target the position and size of the opened window with a slightly modified approach that uses this.href and passes more information to the window.open method.
Of course, as a user of the Internet, I strongly encourage you to revisit any requirements that cause your page to open more windows.
About this page
This page contains a single post from Daniel Boerner's blog, of which Boot Camp + Windows Vista = no more Airport Extreme reboots is the latest post.
Are there more posts like this one?
Possibly. Within this blog, this post is categorized under webdev and it was posted on June 29, 2005. Those would be good places to start looking for related posts.
Next post (newer)
Breaking Windows: How Bill Gates Fumbled the Future of Microsoft
Visitor comments
1 comments
This post is closed to new comments. Thanks to everyone who commented.