XHTML Strict - using target inside <a>

D

Dave Winter

Hi all,

I'm just starting out to convert my web site to XHTML.

I use:

<a href="website.html" target="_blank">Test</a>

I use that a lot - and I was shocked to see when I validated my web
site against the Strict DTD it said that the target tribute was invalid.

I understand that it can be used with regards to frames, but not with
opening links in new windows.

Is there something I should be using instead?

Really appreciate any help that can be given.

Thanks.

Dave.
 
B

brucie

in post: <
Dave Winter said:
I'm just starting out to convert my web site to XHTML.
why?

<a href="website.html" target="_blank">Test</a>
I use that a lot

if your visitors want a new window/tab they can do it themselves.
and I was shocked to see when I validated my web site against the
Strict DTD it said that the target tribute was invalid.
correct

Is there something I should be using instead?

1. ignore the error
2. modify the DTD
3. change the DTD
4. scripting (not recommended)
5. let your visitors open new windows/tabs (recommended)
 
S

Steve Pugh

Dave Winter said:
I'm just starting out to convert my web site to XHTML.

Any particular reason?
<a href="website.html" target="_blank">Test</a>

I use that a lot - and I was shocked to see when I validated my web
site against the Strict DTD it said that the target tribute was invalid.

This has been the case since HTML 4 was released in 1997. So I guess
that you're jumping straight from HTML 4 Transitional to XHTML 1
Strict.
I understand that it can be used with regards to frames, but not with
opening links in new windows.

Frames, windows, same thing - they're media specific and nothing to do
with marking up data, which is what the Strict versions of HTML 4 and
XHTML 1 are all about.
Is there something I should be using instead?

1. Don't try to force new windows on your users, let them choose when
to open a link in a new window or tab.
2. Use a Transitional version instead.
3. Use JavaScript, but be sure to write it in such a way that the link
still works when JS isn't enabled.
4. Ignore validation. Valid code is good but it is only a means to an
end not a goal in itself.

Why do you want you code to validate as XHTML 1.0 Strict?

Steve
 
J

Joshua Beall

Steve Pugh said:
This has been the case since HTML 4 was released in 1997. So I guess
that you're jumping straight from HTML 4 Transitional to XHTML 1
Strict.

Do I correctly interpret this as meaning that there is no valid way to cause
a link to open in a new browser, unless you are using HTML4 Transitional?

Aside from JS solutions. I try to avoid JS when possible though.
 
S

Steve Pugh

Joshua Beall said:
Do I correctly interpret this as meaning that there is no valid way to cause
a link to open in a new browser, unless you are using HTML4 Transitional?

No, you can use XHTML 1.0 Transitional.

Steve
 
D

David Håsäther

Joshua Beall said:
Do I correctly interpret this as meaning that there is no valid
way to cause a link to open in a new browser, unless you are using
HTML4 Transitional?

You could use any DTD that has the target attribute in it.
 
D

Dave Winter

Any particular reason?

This has been the case since HTML 4 was released in 1997. So I guess
that you're jumping straight from HTML 4 Transitional to XHTML 1
Strict.

Frames, windows, same thing - they're media specific and nothing to do
with marking up data, which is what the Strict versions of HTML 4 and
XHTML 1 are all about.


1. Don't try to force new windows on your users, let them choose when
to open a link in a new window or tab.
2. Use a Transitional version instead.
3. Use JavaScript, but be sure to write it in such a way that the link
still works when JS isn't enabled.
4. Ignore validation. Valid code is good but it is only a means to an
end not a goal in itself.

Why do you want you code to validate as XHTML 1.0 Strict?
Steve

There's no real reason why, I'm just looking into how easy it would be
to convert it to XHTML.

From what I've seen of XHTML code, it's so much tidier. This is
probably the main reason for me.

And I like the point you make about not forcing new windows to open.

I'll make a new post in a few minutes asking about converting my site
from <table> to <div>
 
J

Joshua Beall

Steve Pugh said:
No, you can use XHTML 1.0 Transitional.

Oops, phrased my question wrong: there is no valid to cause a link to open
in a new browser, if you are using an XHTML1.0/1.1 Strict doctype?
 
D

David Dorward

Joshua said:
Oops, phrased my question wrong: there is no valid to cause a link to open
in a new browser, if you are using an XHTML1.0/1.1 Strict doctype?

XHTML 1.0 Strict - no
XHTML 1.1 - no
XHTML 1.1 Strict - no such thing
XHTML 1.1 with a frames module of some description[1] - yes

[1] I'm being vague here because I haven't been inclined to use any modules
with XHTML 1.1 so its somewhat outside my experience.
 
M

Mitja

Dave Winter said:
There's no real reason why, I'm just looking into how easy it would be
to convert it to XHTML.

From what I've seen of XHTML code, it's so much tidier. This is
probably the main reason for me.

It's just that it enforces at least a kind of tidiness, but it can be
achieved just as well with HTML. It's mainly a matter of consistently
closing tags that are only optionally closed and _indenting_ everything.
 
D

DU

Dave said:
Hi all,

I'm just starting out to convert my web site to XHTML.

I use:

<a href="website.html" target="_blank">Test</a>

I use that a lot - and I was shocked to see when I validated my web site
against the Strict DTD it said that the target tribute was invalid.

I understand that it can be used with regards to frames, but not with
opening links in new windows.

Is there something I should be using instead?

Really appreciate any help that can be given.

Thanks.

Dave.

<a href="website.html" target="_blank">Test</a>

I strongly discourage this way of coding links in documents whatever the
DTD, strict or transitional. Because

- the new separate window is unnamed. Therefore the window is not
reusable nor recyclable. At the very least, don't use _blank at all. If
you're opening a new window for only 1 link, then you might rethink the
whole issue again.

- none of the WAI recommendations are implemented: so users can not know
in advance that clicking the window will open the referenced resource in
a new window. This will for sure irritate users.

DU
 
J

Jukka K. Korpela

brucie said:
the appendix c paradox. i really don't see the point of authoring HTML
thats pretending to be XHTML pretending to be HTML.

So you mean we should stick to authoring tag soup that pretends to be
HTML that pretends to be an application of SGML that pretends to be
a standard generalized markup language? :)

(That's what I mean, anyway. Though I might add that we should not
_unnecessarily_ deviate from the syntax of XHTML that pretends to be an
application of XML that pretends to be better than SGML.)
 
B

brucie

in post: <
So you mean we should stick to authoring tag soup that pretends to be
HTML that pretends to be an application of SGML that pretends to be
a standard generalized markup language? :)

LOL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top