Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > converting to STRICT (href values and target attribute)

Reply
Thread Tools

converting to STRICT (href values and target attribute)

 
 
petermichaux@gmail.com
Guest
Posts: n/a
 
      10-01-2006
Hi,

I am converting an old page to STRICT.

When validating the page I learned that I can't have a link like the
following. The '&' and '=' characters are not allowed? How can I make
this link validate?

<a
href="http://www.foo.com/cgi-bin/test.pl?ACCOUNT=1006458&THE_BUTTON=display_page&PA GE_TYPE=MI_PPC#ASDF">


I also learned that I can't use the "target" attribute in STRICT pages
like the following. What do I do to get around this? Do I have to write
JavaScript in the onclick attribute? That wouldn't be so good if
JavaScript is off.

<a href="http://www.7Search.com/" target="new">7Search.com</a>

Thank you,
Peter

 
Reply With Quote
 
 
 
 
dorayme
Guest
Posts: n/a
 
      10-01-2006
In article
<(E-Mail Removed). com>,
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> Hi,
>
> I am converting an old page to STRICT.
>
> When validating the page I learned that I can't have a link like the
> following. The '&' and '=' characters are not allowed? How can I make
> this link validate?
>
> <a
> href="http://www.foo.com/cgi-bin/test.pl?ACCOUNT=1006458&THE_BUTTON=display_pa
> ge&PAGE_TYPE=MI_PPC#ASDF">
>
>


Best to post the url for this as email and ng postings can pay
tricks on url presentations

> I also learned that I can't use the "target" attribute in STRICT pages
> like the following. What do I do to get around this? Do I have to write
> JavaScript in the onclick attribute? That wouldn't be so good if
> JavaScript is off.
>
> <a href="http://www.7Search.com/" target="new">7Search.com</a>
>


Not heard of "new" as a value here? Don't use strict if you need
target. You using frames?

--
dorayme
 
Reply With Quote
 
 
 
 
petermichaux@gmail.com
Guest
Posts: n/a
 
      10-01-2006
dorayme wrote:
> In article
> <(E-Mail Removed). com>,
> (E-Mail Removed) wrote:
>
> > I am converting an old page to STRICT.
> >
> > When validating the page I learned that I can't have a link like the
> > following. The '&' and '=' characters are not allowed? How can I make
> > this link validate?
> >
> > <a
> > href="http://www.foo.com/cgi-bin/test.pl?ACCOUNT=1006458&THE_BUTTON=display_pa
> > ge&PAGE_TYPE=MI_PPC#ASDF">

>
> Best to post the url for this as email and ng postings can pay
> tricks on url presentations


I'm not sure what you mean. The URL has a '?' followed by parameters
like this

ACCOUNT=1006458&THE_BUTTON=display_page

http://www.foo.com/cgi-bin/test.pl?A...PE=MI_PPC#ASDF

The ampersands and equals signs are apparently not allowed with the
strict doctype.


> > I also learned that I can't use the "target" attribute in STRICT pages
> > like the following. What do I do to get around this? Do I have to write
> > JavaScript in the onclick attribute? That wouldn't be so good if
> > JavaScript is off.
> >
> > <a href="http://www.7Search.com/" target="new">7Search.com</a>
> >

>
> Not heard of "new" as a value here? Don't use strict if you need
> target. You using frames?


I'm not using frames. The target is for a new window that may already
be open. For example, if I have the following in a page then the first
click opens a new window. More clicks change that same new window.

<p><a href="http://www.google.com" target="foo">google.com</a></p>
<p><a href="http://www.yahoo.com" target="foo">yahoo.com</a></p>

How to convert this kind of behavior to strict doctype?

Thanks,
Peter

 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      10-01-2006
In article
<(E-Mail Removed). com>,
(E-Mail Removed) wrote:

> dorayme wrote:
> >
> > Best to post the url for this as email and ng postings can pay
> > tricks on url presentations

>
> I'm not sure what you mean.


Just that you should try to put up your efforts on a server so we
can see what you are doing, you give us an address of where to
look.

> > >
> > > <a href="http://www.7Search.com/" target="new">7Search.com</a>
> > >

> >
> > Not heard of "new" as a value here? Don't use strict if you need
> > target. You using frames?

>
> I'm not using frames. The target is for a new window that may already
> be open. For example, if I have the following in a page then the first
> click opens a new window. More clicks change that same new window.
>
> <p><a href="http://www.google.com" target="foo">google.com</a></p>
> <p><a href="http://www.yahoo.com" target="foo">yahoo.com</a></p>
>
> How to convert this kind of behavior to strict doctype?


Where did you get the idea to use the word "new"? I may be
missing something.

If you want a link to open in a new window, you can use the
construction <a href="destination.html" target="_blank">

You can use this in docs with

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

They will not validate. This is not the end of the world. You can
still do it. Many browsers will not blink and it will work as you
want.

Your other choice is to use a transitional doc type.

The other thing you can do, and this is generally the best thing
to do: review your wanting to control the windows of website
user. Now that there is tabbed browsing and greater familiarity
with browsers, it is often best to simply leave all this stuff to
the user. This is another reason a URL is desirable. So your
business can be seen completely and we can poke our noses in and
say what is what and how things should or should not be.

--
dorayme
 
Reply With Quote
 
richard
Guest
Posts: n/a
 
      10-01-2006

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Hi,
>
> I am converting an old page to STRICT.
>
> When validating the page I learned that I can't have a link like the
> following. The '&' and '=' characters are not allowed? How can I make
> this link validate?
>
> <a
> href="http://www.foo.com/cgi-bin/test.pl?ACCOUNT=1006458&THE_BUTTON=display_page&PA GE_TYPE=MI_PPC#ASDF">
>
>
> I also learned that I can't use the "target" attribute in STRICT pages
> like the following. What do I do to get around this? Do I have to write
> JavaScript in the onclick attribute? That wouldn't be so good if
> JavaScript is off.
>
> <a href="http://www.7Search.com/" target="new">7Search.com</a>
>
> Thank you,
> Peter
>


The validator generally gives you some reasons why the error occurred. Read
up on them.

In general, &amp is best used instead of just &.
"new" should be _blank.
You should take the time to learn what attributes go with which terms.
learn the basics of coding.

 
Reply With Quote
 
Sally Thompson
Guest
Posts: n/a
 
      10-01-2006
On Sun, 1 Oct 2006 03:53:38 +0100, richard wrote
(in article <(E-Mail Removed)>):

>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) ups.com...
>> Hi,
>>
>> I am converting an old page to STRICT.
>>
>> When validating the page I learned that I can't have a link like the
>> following. The '&' and '=' characters are not allowed? How can I make
>> this link validate?
>>
>> <a
>> href="http://www.foo.com/cgi-bin/test.pl?ACCOUNT=1006458&THE_BUTTON=display_
>> page&PAGE_TYPE=MI_PPC#ASDF">
>>
>>
>> I also learned that I can't use the "target" attribute in STRICT pages
>> like the following. What do I do to get around this? Do I have to write
>> JavaScript in the onclick attribute? That wouldn't be so good if
>> JavaScript is off.
>>
>> <a href="http://www.7Search.com/" target="new">7Search.com</a>
>>
>> Thank you,
>> Peter
>>

>
> The validator generally gives you some reasons why the error occurred. Read
> up on them.
>
> In general, &amp is best used instead of just &.


You have forgotten the semi-colon: it should be &amp;

To the OP: I like this chart which I find clearer than some:

<http://www.cookwood.com/entities/#punctuation>



--
Sally in Shropshire, UK
bed and breakfast near Ludlow: http://www.stonybrook-ludlow.co.uk
Burne-Jones/William Morris window in Shropshire church:
http://www.whitton-stmarys.org.uk

 
Reply With Quote
 
Joel Shepherd
Guest
Posts: n/a
 
      10-01-2006
In article <(E-Mail Removed). com>,
(E-Mail Removed) wrote:

> Hi,
>
> I am converting an old page to STRICT.
>
> When validating the page I learned that I can't have a link like the
> following. The '&' and '=' characters are not allowed? How can I make
> this link validate?
>
> <a
> href="http://www.foo.com/cgi-bin/test.pl?ACCOUNT=1006458&THE_BUTTON=display_pa
> ge&PAGE_TYPE=MI_PPC#ASDF">


http://www.example.com/cgi-bin/test....THE_BUTTON=dis
play_page&amp;PAGE_TYPE=MI_PPC#ASDF

.... Should make the validator happier.

Why? Suppose your URL looked like this instead:

http://www.example.com/cgi-bin/test....=2&PAGE_TYPE=M
I_PPC#ASDF

&copy is a defined character entity in HTML. The href value in a link is
CDATA, and browsers are supposed to interpret CDATA:

"CDATA is a sequence of characters from the document character set and
may include character entities. User agents should interpret attribute
values as follows:
* Replace character entities with characters,
* Ignore line feeds,
* Replace each carriage return or tab with a single space."

(http://www.w3.org/TR/html401/types.html#type-cdata)

So your browser would be strongly tempted to replace the &COPY in the
above URL with a copyright symbol character ... and that's probably not
what you want.

Use &amp; instead of & in URLs to separate parameters: browsers will
handle it properly and you'll avoid risk of unintended interpretation.

> I also learned that I can't use the "target" attribute in STRICT pages
> like the following. What do I do to get around this? Do I have to write
> JavaScript in the onclick attribute?


Yes.

> That wouldn't be so good if JavaScript is off.


True, but if the user turned it off, he/she probably knows how to open
pages in new windows/tabs/whatever anyways. If the user isn't human, it
doesn't care.

--
Joel.
 
Reply With Quote
 
usenet+2004@john.dunlop.name
Guest
Posts: n/a
 
      10-01-2006
richard:

> In general, &amp is best used instead of just &.


although if a Name character follows, the entity reference must be
closed explicitly, with a semi-colon.

> "new" should be _blank.


They mean different things. With 'new', user-agents SHOULD either load
the resource in a new frame named 'new' or if a frame named 'new'
already exists, load the resource in that frame. The spec talks about
known and unknown frames here. With '_blank', they SHOULD load the
resource in a 'new, unnamed window', regardless of existing frames.
All that assumes that the user-agent understands 'target', that it
doesn't override the attribute, and that there are such things as
frames and windows.

--
Jock

 
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
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
XHTML Strict - using target inside <a> Dave Winter HTML 16 04-08-2004 10:29 AM
Form target attribute--not validating with strict doctype? TheKeith HTML 9 10-21-2003 11:06 PM



Advertisments