473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

No target attribute in the A element (XHTML 1.0)

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
16 12267
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
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
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
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
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
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
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
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
"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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Lars Schlanbusch | last post by:
Hi! Is there any way to set <base target="_blank"> for links which link to a page outside the domain, and <base target="_self"> for links which link to a page inside the domain? Can i do such...
2
by: piraticman | last post by:
Hi. I have some code for a javascript jump menu... It validated with HTML 4.0 but now does not validate with XHTML strict 1.0. I have used name atributes in my code which aparantly are not...
2
by: Stanimir Stamenkov | last post by:
I'm trying to find out if it is permissible to include a schema document with absent target namespace to a schema with specified target namespace, and if it is, what are the rules to resolve the...
24
by: Mike | last post by:
Hello How do i get around target="_blank" is not allowed in xtml strict? Thanks Mike
9
by: aragon | last post by:
Hi all, is it legal to use a fully-numeric string as "name" attribute for the <select> tag in the XHTML standard? E.g.: <form action="action.php" method="get"> <select name="12345"> <option...
16
by: St. Rechsteiner | last post by:
Hi How i made the same effect in xHTML like the - target="_blank" - Tag in HTML 4.01? I will use it with xHTML and CSS ... but the validator say's to me, that this tag wasn't valid for xHTML!...
8
by: pocm | last post by:
Hi, What's the property/value I need to set in css for A to mimic the results of <a href="..." target="_new">...</a>? Cheers, Paulo Matos
2
by: Matt | last post by:
In the following code, page1.asp is inside the frame of main.html. When the user click submit button in page1.asp, it will submit the form and open a new window called page2.asp. When the user...
92
by: Erwin Moller | last post by:
Hi group, I encoutered page validation error, but I don't know a way around. The page has the following doctype: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.