By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,613 Members | 1,460 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,613 IT Pros & Developers. It's quick & easy.

No target attribute in the A element (XHTML 1.0)

P: n/a
When using the XHTML 1.0 validator at http://validator.w3.org/check, an
error will be raised for every instance of a "target" attribute in "A"
elements. Is it truely because it is not part of this specification
anymore, or is it an error in the SGML parser ? Any alternatives ?

html code :

<a href="./page.html" class="pagelink" target="_self">some text</a>

used doctype :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Result received :

This page is not Valid XHTML 1.0 Strict!
Line 66, column 66: there is no attribute "target" (explain...).
<a href="./page.html" class="pagelink" target="_self">some text</a>

Mark van Ballegooijen
Jul 20 '05 #1
Share this Question
Share on Google+
16 Replies


P: n/a
Els
Mark van Ballegooijen wrote:
When using the XHTML 1.0 validator at http://validator.w3.org/check, an
error will be raised for every instance of a "target" attribute in "A"
elements. Is it truely because it is not part of this specification
anymore, or is it an error in the SGML parser ? Any alternatives ?

html code :

<a href="./page.html" class="pagelink" target="_self">some text</a>

used doctype :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Result received :

This page is not Valid XHTML 1.0 Strict!
Line 66, column 66: there is no attribute "target" (explain...).
<a href="./page.html" class="pagelink" target="_self">some text</a>


Are you trying to use frames?
I guess not, so, why are you using target? Without a target,
any link will open in the same window, which you seem to
want, using "_self"...

As far as I know, the target attribute isn't part of XHTML,
and was only intended to be used within a frameset.
It's not part of HTML 4.01 Strict either.

--
Els

Mente humana é como pára-quedas; funciona melhor aberta.

Jul 20 '05 #2

P: n/a
Els wrote:
Mark van Ballegooijen wrote:
When using the XHTML 1.0 validator at http://validator.w3.org/check,
an error will be raised for every instance of a "target" attribute in
"A" elements. Is it truely because it is not part of this
specification anymore, or is it an error in the SGML parser ? Any
alternatives ?

html code :

<a href="./page.html" class="pagelink" target="_self">some text</a>

used doctype :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Result received :

This page is not Valid XHTML 1.0 Strict!
Line 66, column 66: there is no attribute "target" (explain...).
<a href="./page.html" class="pagelink" target="_self">some text</a>

Are you trying to use frames?
I guess not, so, why are you using target? Without a target, any link
will open in the same window, which you seem to want, using "_self"...

As far as I know, the target attribute isn't part of XHTML, and was only
intended to be used within a frameset.
It's not part of HTML 4.01 Strict either.


No, I'm not using frames.

You're right about the window though, _self is the current one so it's
actually quite useless. The reason i use it is that i would like links
to pages on my own website/server to be opened in the current window
(_self), and external links in a new window (_blank). If this
attribute is indeed deprecated, which seems to be the case, is there an
alternative to target="_blank" to open hyperlinks in a new/blank window ?

Mark van Ballegooijen
Jul 20 '05 #3

P: n/a
On Fri, 20 Feb 2004, Mark van Ballegooijen wrote:
When using the XHTML 1.0 validator at http://validator.w3.org/check, an
error will be raised for every instance of a "target" attribute in "A"
elements. Is it truely because it is not part of this specification
anymore, or is it an error in the SGML parser ? Any alternatives ?


Avoid frames like the plague!

Jul 20 '05 #4

P: n/a
Els
Mark van Ballegooijen wrote:
You're right about the window though, _self is the current one so it's
actually quite useless. The reason i use it is that i would like links
to pages on my own website/server to be opened in the current window
(_self), and external links in a new window (_blank). If this
attribute is indeed deprecated, which seems to be the case, is there an
alternative to target="_blank" to open hyperlinks in a new/blank window ?


Not that I know of, other than using javascript.
I have the same idea as you about external links opening in
a new window, that's why I use HTML 4.01 Transitional on
pages with external links, and not Strict or XHTML.

A lot of people (on usenet in web-related groups) have the
opinion though, that a link should always open in the same
window, because the user is able to right click a link if he
wants it in a new window (or tab).

--
Els

Mente humana é como pára-quedas; funciona melhor aberta.

Jul 20 '05 #5

P: n/a
Els wrote:
Mark van Ballegooijen wrote:
You're right about the window though, _self is the current one so it's
actually quite useless. The reason i use it is that i would like links
to pages on my own website/server to be opened in the current window
(_self), and external links in a new window (_blank). If this
attribute is indeed deprecated, which seems to be the case, is there
an alternative to target="_blank" to open hyperlinks in a new/blank
window ?

Not that I know of, other than using javascript.
I have the same idea as you about external links opening in a new
window, that's why I use HTML 4.01 Transitional on pages with external
links, and not Strict or XHTML.

A lot of people (on usenet in web-related groups) have the opinion
though, that a link should always open in the same window, because the
user is able to right click a link if he wants it in a new window (or tab).


So it seems.

i'll just use the current window for all links, and leave the target
attribute out then (i'm not a real javascript supporter for these kind
of things).

Anyway, thanks a lot for the quick replies !

Mark van Ballegooijen
Jul 20 '05 #6

P: n/a
Mark van Ballegooijen <mv************@xs4all.nl> wrote:
When using the XHTML 1.0 validator at http://validator.w3.org/check, an
error will be raised for every instance of a "target" attribute in "A"
elements. Is it truely because it is not part of this specification
anymore, or is it an error in the SGML parser ? Any alternatives ?


The target attribute has not been part of the Strict (X)HTML
specifications since 1997. It has only ever been part of the
Transitional specifications. This is the same for HTMl 4.0, HTML 4.01
and XHTML 1.0.

There are two reasons to use target : frames and new windows.
Neither frames nor the forced opening of new windows are in the spirit
of the Strict versions of (X)HTML. So either don't use them, or use a
Transitional version instead.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #7

P: n/a
On Fri, 20 Feb 2004, Steve Pugh wrote:
There are two reasons to use target : frames and new windows.


And a third - to try to avoid getting one's own page framed by someone
else.

But I'm afraid that baby has to get thrown out with the bathwater, if
one's aim is to get validated against the strict DTD.
Jul 20 '05 #8

P: n/a
Steve Pugh wrote:
There are two reasons to use target : frames and new windows.

Alan J. Flavell <fl*****@ph.gla.ac.uk> wrote: And a third - to try to avoid getting one's own page framed by someone
else.

But I'm afraid that baby has to get thrown out with the bathwater, if
one's aim is to get validated against the strict DTD.


Yep.

I created a custom DTD that is essentially a copy of the Strict DTD, with
target="_top" allowed, and a couple things that I want to avoid (like <q>)
removed. I validate against my (almost Strict) custom DTD, and then
advertise the documents to be Transitional (which they are).
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"The early bird gets the worm, but the second mouse gets the cheese."
Jul 20 '05 #9

P: n/a
"Alan J. Flavell" <fl*****@ph.gla.ac.uk> wrote:
On Fri, 20 Feb 2004, Steve Pugh wrote:
There are two reasons to use target : frames and new windows.
And a third - to try to avoid getting one's own page framed by someone
else.


I was including that in the general category of 'frames'.
But I'm afraid that baby has to get thrown out with the bathwater, if
one's aim is to get validated against the strict DTD.


Though I'm sure we agree that that's an odd aim to have. Validation is
means to an end not an end in itself.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #10

P: n/a
On Fri, 20 Feb 2004 18:21:14 +0100, Els <el*********@tiscali.nl> wrote:
A lot of people (on usenet in web-related groups) have the opinion
though, that a link should always open in the same window, because the
user is able to right click a link if he wants it in a new window (or
tab).


On an external links page, I'm likely to recommend right-clicking and
opening the link in a new window. But yes, it's not polite to force a new
window, especially since more and more people are blocking popups and
there's a good chance the link will fail if you try it.
Jul 20 '05 #11

P: n/a
Neal <ne*****@spamrcn.com> wrote:
But yes, it's not polite to force a new
window, especially since more and more people are blocking popups and
there's a good chance the link will fail if you try it.


New window != Popup.

A UA configured not to allow new windows will open the link in the
existing window (no failure).

--
Spartanicus
Jul 20 '05 #12

P: n/a
On Fri, 20 Feb 2004 21:35:00 +0000, Spartanicus <me@privacy.net> wrote:
Neal <ne*****@spamrcn.com> wrote:
But yes, it's not polite to force a new
window, especially since more and more people are blocking popups and
there's a good chance the link will fail if you try it.


New window != Popup.

A UA configured not to allow new windows will open the link in the
existing window (no failure).

Not in each case. I used a popup blocker briefly which required me to
Control-click to override the block. If I did not, it didn't open it at
all. Wish I remembered the name of the software, but it was some time ago.

Still, never safe to assume, always better to code as fool-proof as
possible.
Jul 20 '05 #13

P: n/a
Neal <ne*****@spamrcn.com> wrote:
A UA configured not to allow new windows will open the link in the
existing window (no failure).


Not in each case. I used a popup blocker briefly which required me to
Control-click to override the block.


Again: New window != Popup.

--
Spartanicus
Jul 20 '05 #14

P: n/a
In article
<2a********************************@news.spartanic us.utvinternet.ie>,
Spartanicus <me@privacy.net> wrote:
Neal <ne*****@spamrcn.com> wrote:
A UA configured not to allow new windows will open the link in the
existing window (no failure).


Not in each case. I used a popup blocker briefly which required me to
Control-click to override the block.


Again: New window != Popup.


Some pop-up blockers seem to disagree, however.

--
| Andrew Glasgow <amg39(at)cornell.edu> |
| "Provide me with ships or proper sails for the celestial atmosphere and |
| there will be men there, too, who do not fear the appalling distance" |
| -- Johannes Kepler |
Jul 20 '05 #15

P: n/a
On Fri, 20 Feb 2004 21:52:43 +0000, Spartanicus <me@privacy.net> wrote:
Neal <ne*****@spamrcn.com> wrote:
A UA configured not to allow new windows will open the link in the
existing window (no failure).


Not in each case. I used a popup blocker briefly which required me to
Control-click to override the block.


Again: New window != Popup.

I have no idea what you mean with the !, it sure as hell ain't HTML. I
can't tell if you're agreeing with me or arguing with me.
Jul 20 '05 #16

P: n/a
Spartanicus <me@privacy.net> wrote:
Again: New window != Popup.

Like beauty, this is in the eye of the beholder.

For example, Opera makes a distinction between requested pop-up windows and
unrequested pop-up windows. I think you're using the terms "new window" and
"popup" to make this same distinction.

I'm not sure what I find more annoying: links that open new windows when I
don't want them, or links that try to open new windows when I do want them,
but which then don't work at all because the JavaScript gets confused by
the new windows that I've opened.

Neal <ne*****@spamrcn.com> wrote: I have no idea what you mean with the !, it sure as hell ain't HTML. I
can't tell if you're agreeing with me or arguing with me.


Many programming languages use ! for logical negation, != for "not equal
to", and so on. Spartanicus is simply asserting that new windows are not
necessarily pop-up windows.
--
Darin McGrew, mc****@stanfordalumni.org, http://www.rahul.net/mcgrew/
Web Design Group, da***@htmlhelp.com, http://www.HTMLHelp.com/

"Mistakes are the portals of discovery." - James Joyce
Jul 20 '05 #17

This discussion thread is closed

Replies have been disabled for this discussion.