468,136 Members | 1,444 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,136 developers. It's quick & easy.

target="_new" is not strict xml1.0, how to do it in css?

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

Jul 21 '05 #1
8 10526
po**@sat.inesc-id.pt wrote:
What's the property/value I need to set in css for A to mimic the
results of
<a href="..." target="_new">...</a>?
There isn't one in CSS up to version 2.1.
target="_new" is not strict xml1.0, how to do it in css?


target="_new" is wrong. See
http://www.w3.org/TR/html401/types.h...e-frame-target
Browsers will correct your error in one of three ways:
1. Ignore the target attribute
2. Treat it as target="new"
3. Treat it as target="_blank"
The difference between the last two will become apprarent if you have
multiple links with the same target attribute. In case (2) the same
window will be reused (so there are only every two windows) whilst in
case (3) a new window will be created for every link.

I guess that xml1.0 is a typo for XHTML 1.0?

This is NOT an HTML vs XHTML issue. The target attribute isn't in HTML
4 Strict either.

You have four options:
1. Don't open new windows, leave that up to the user
2. Use a Transitional version of HTML or XHTML instead
3. Use JavaScript instead
4. Don't worry about it not validating

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 21 '05 #2
po**@sat.inesc-id.pt wrote:
Hi,

What's the property/value I need to set in css for A to mimic the
results of
<a href="..." target="_new">...</a>?


Gee, an easy question. Answer: you don't. YOU may want a new window,
what make you think your visitor does?

--
Stan McCann "Uncle Pirate" http://stanmccann.us/pirate.html
Webmaster/Computer Center Manager, NMSU at Alamogordo
Coordinator, Tularosa Basin Chapter, ABATE of NM; AMA#758681; COBB
'94 1500 Vulcan (now wrecked) :( http://motorcyclefun.org/Dcp_2068c.jpg
A zest for living must include a willingness to die. - R.A. Heinlein
Jul 21 '05 #3
On Thu, 03 Mar 2005 17:49:37 -0300, Uncle Pirate <st**@surecann.com> wrote:
po**@sat.inesc-id.pt wrote:
Hi,
What's the property/value I need to set in css for A to mimic the
results of
<a href="..." target="_new">...</a>?


Gee, an easy question. Answer: you don't. YOU may want a new window,
what make you think your visitor does?


I agree with you, but when it comes to customers, sometimes they don't
understand and get mad. I remember one that called me furious and asked to
open most links of his new web site in a new window. I used a javascript
to simulate it.

<a href="http://google.com" onclick="window.open(this.href); return
false;">link</a>
--
Boost the visibility of your web site in Google!
http://www.digitalpoint.com/tools/ad-network/?s=5203

Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

http://www.auriance.com - http://www.auriance.net
Jul 21 '05 #4
DU
Steve Pugh wrote:
po**@sat.inesc-id.pt wrote:

What's the property/value I need to set in css for A to mimic the
results of
<a href="..." target="_new">...</a>?

There isn't one in CSS up to version 2.1.

target="_new" is not strict xml1.0, how to do it in css?

target="_new" is wrong. See
http://www.w3.org/TR/html401/types.h...e-frame-target
Browsers will correct your error in one of three ways:
1. Ignore the target attribute
2. Treat it as target="new"
3. Treat it as target="_blank"


Non-Mozilla browsers will treat it as a new named window; Mozilla
browsers will treat it as a new unnamed window.

The difference between the last two will become apprarent if you have
multiple links with the same target attribute. In case (2) the same
window will be reused (so there are only every two windows) whilst in
case (3) a new window will be created for every link.

I guess that xml1.0 is a typo for XHTML 1.0?

This is NOT an HTML vs XHTML issue. The target attribute isn't in HTML
4 Strict either.

You have four options:
1. Don't open new windows, leave that up to the user
Best.
2. Use a Transitional version of HTML or XHTML instead
3. Use JavaScript instead
4. Don't worry about it not validating

Steve


DU
--
The site said to use Internet Explorer 5 or better... so I switched to
Mozilla 1.7.5 :)
Jul 21 '05 #5
DU
po**@sat.inesc-id.pt wrote:
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

In a few years from now, the target property of the CSS3 hyperlink module
http://www.w3.org/TR/2004/WD-css3-hy...40224/#target0
may be implemented (if CSS3 Hyperlink module as it is right now is
approved).

<a href="..." style="target: new window above;">...</a>
or
<a href="..." style="target-name: new; target-new: window;
target-position: above;">...</a>

And even if and when such possibility happens, you can expect browser
manufacturers and Mozilla browsers (and other browsers based on/offering
tab-browsing) to give the user entire veto power and full control over
how links can open web pages. How to open a link should always be
entirely under the control and the power of the user.

DU
--
The site said to use Internet Explorer 5 or better... so I switched to
Mozilla 1.7.5 :)
Jul 21 '05 #6
Unknown User wrote:
On Thu, 03 Mar 2005 17:49:37 -0300, Uncle Pirate <st**@surecann.com> wrote:
po**@sat.inesc-id.pt wrote:
Hi,
What's the property/value I need to set in css for A to mimic the
results of
<a href="..." target="_new">...</a>?

Gee, an easy question. Answer: you don't. YOU may want a new
window, what make you think your visitor does?


I agree with you, but when it comes to customers, sometimes they don't
understand and get mad. I remember one that called me furious and asked
to open most links of his new web site in a new window. I used a
javascript to simulate it.


I'm not sure what is meant by simulate it in this case. Either a window
opens or it doesn't? Using JavaScript is probably a good idea when
opening a window. I'd think (no research or figures, JMO) that those
leaving JavaScript enabled are less likely no be irritated by a new
window. In my experience, users that block popups and cookies, turn off
Java and JavScript, etc. do it all. Those that don't, do none of it.

As web developers/maintainers, we must do things that are against our
ideas/principles. For instance, something I feel rather strongly about
is file types; HTML for viewing, pdf for printing, application (Word,
Excel) for sharing editable files with others having the same
application. But, I have people putting up Word and Excel files for the
purpose of viewing that don't understand that we still have lots of
people on our own campus that still use Office 97 and cannot view the
Word XP files that they are linking in.

<a href="http://google.com" onclick="window.open(this.href); return
false;">link</a>


This does or doesn't open a new window? Is this what you are calling
"simulating" a new window?

I know this is off topic, but this response got me curious.

--
Stan McCann "Uncle Pirate" http://stanmccann.us/pirate.html
Webmaster/Computer Center Manager, NMSU at Alamogordo
Coordinator, Tularosa Basin Chapter, ABATE of NM; AMA#758681; COBB
'94 1500 Vulcan (now wrecked) :( http://motorcyclefun.org/Dcp_2068c.jpg
A zest for living must include a willingness to die. - R.A. Heinlein
Jul 21 '05 #7
On Fri, 04 Mar 2005 13:12:04 -0300, Uncle Pirate <st**@surecann.com> wrote:
<a href="http://google.com" onclick="window.open(this.href); return
false;">link</a>


This does or doesn't open a new window? Is this what you are calling
"simulating" a new window?


Dear uncle, this snippet opens the link in a new tab/window, and is fully
complient with XHTML 1.0 Strict and 1.1.
--
Boost the visibility of your web site in Google!
http://www.digitalpoint.com/tools/ad-network/?s=5203

Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

http://www.auriance.com - http://www.auriance.net
Jul 21 '05 #8
Unknown User wrote:
On Fri, 04 Mar 2005 13:12:04 -0300, Uncle Pirate <st**@surecann.com> wrote:
<a href="http://google.com" onclick="window.open(this.href);
return false;">link</a>

This does or doesn't open a new window? Is this what you are calling
"simulating" a new window?

Dear uncle, this snippet opens the link in a new tab/window, and is
fully complient with XHTML 1.0 Strict and 1.1.

That's what I thought it looked like. I'm just a bit confused by the
reference to "simulating" opening a window. Wondering what was meant by
that.

--
Stan McCann "Uncle Pirate" http://stanmccann.us/pirate.html
Webmaster/Computer Center Manager, NMSU at Alamogordo
Coordinator, Tularosa Basin Chapter, ABATE of NM; AMA#758681; COBB
'94 1500 Vulcan (now wrecked) :( http://motorcyclefun.org/Dcp_2068c.jpg
A zest for living must include a willingness to die. - R.A. Heinlein
Jul 21 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.