Help - Search - Members - Calendar
Full Version: opening links in a new window
HTMLHelp Forums > Web Authoring > General Web Design
oddcarout
I have some links that I want to open in another window so that people don't leave my site.

Thank you,
Z
Darin McGrew
Please see the FAQ entry How do I create a link that opens a new window?
Corey Bryant
If you are using XHTML check out xhtml target= on one way to still be compliant
Darin McGrew
QUOTE(Corey Bryant @ Dec 29 2006, 04:12 AM) *
If you are using XHTML check out xhtml target= on one way to still be compliant
If you're going to use the TARGET attribute, why not just use a Transitional doctype declaration, rather than using the JavaScript subterfuge? If you're going to use a Strict doctype declaration, then just leave the decision to open a new window with the user, where it should be.
Corey Bryant
I have just used that script before just to at least validate the code
john f
QUOTE(Corey Bryant @ Dec 29 2006, 05:10 PM) *

I have just used that script before just to at least validate the code

The following appears to work and validate for XHTML 1.0 Strict:
<p><a href="baktest.htm" onclick="window.open('baktest.htm');return false;">baktest</a></p>
Frederiek
Only, then you rely on javascript, which is not always desirable.
pandy
It has nothing to do with XHTML. It has to do with Strict or Transitional.
Darin McGrew
QUOTE
Only, then you rely on javascript, which is not always desirable.
Actually, the links work fine without JavaScript. The main problem is that those with JavaScript enabled don't get to choose whether to open the links in a new window.
Frederiek
Oops, I overlooked the href. Sorry.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.