Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > XHTML Strict - using target inside <a>

Reply
Thread Tools

XHTML Strict - using target inside <a>

 
 
Dave Winter
Guest
Posts: n/a
 
      04-07-2004
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.

 
Reply With Quote
 
 
 
 
brucie
Guest
Posts: n/a
 
      04-07-2004
in post: <news:2004040715424616807%davewinter@maccom>
Dave Winter <(E-Mail Removed)> 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)

--
b r u c i e
 
Reply With Quote
 
 
 
 
Steve Pugh
Guest
Posts: n/a
 
      04-07-2004
Dave Winter <(E-Mail Removed)> wrote:

>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

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

Steve Pugh <(E-Mail Removed)> <http://steve.pugh.net/>
 
Reply With Quote
 
Joshua Beall
Guest
Posts: n/a
 
      04-07-2004
"Steve Pugh" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> ><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.


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.


 
Reply With Quote
 
Steve Pugh
Guest
Posts: n/a
 
      04-07-2004
"Joshua Beall" <(E-Mail Removed)> wrote:

>"Steve Pugh" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed).. .
>> ><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.

>
>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



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

Steve Pugh <(E-Mail Removed)> <http://steve.pugh.net/>
 
Reply With Quote
 
David Håsäther
Guest
Posts: n/a
 
      04-07-2004
Joshua Beall <(E-Mail Removed)> wrote:

> "Steve Pugh" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> ><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.

>
> 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.

--
David Håsäther
 
Reply With Quote
 
Dave Winter
Guest
Posts: n/a
 
      04-07-2004
On 2004-04-07 16:01:26 +0100, Steve Pugh <(E-Mail Removed)> said:

> Dave Winter <(E-Mail Removed)> wrote:
>
>> 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


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>

 
Reply With Quote
 
Joshua Beall
Guest
Posts: n/a
 
      04-07-2004
"Steve Pugh" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> >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.


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?


 
Reply With Quote
 
David Dorward
Guest
Posts: n/a
 
      04-07-2004
Joshua Beall wrote:

> 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.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
 
Reply With Quote
 
Brendan Taylor
Guest
Posts: n/a
 
      04-07-2004
On Thu, 08 Apr 2004 00:54:49 +1000, brucie wrote:

> in post: <news:2004040715424616807%davewinter@maccom>
> Dave Winter <(E-Mail Removed)> said:
>
>> I'm just starting out to convert my web site to XHTML.

>
> why?


Why not?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
converting to STRICT (href values and target attribute) petermichaux@gmail.com HTML 7 10-01-2006 05:16 PM
No target="_blank" allowed in HTML 4.01 Strict!? metalive HTML 24 03-31-2005 02:17 PM
TARGET=_blank not in strict HTML.... WindAndWaves HTML 13 12-27-2004 10:50 PM
HTML 4.01 Strict & the Target attribute Simon HTML 21 10-31-2004 03:41 PM
Form target attribute--not validating with strict doctype? TheKeith HTML 9 10-21-2003 11:06 PM



Advertisments