navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

target="_blank"

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> Cascading Style Sheets >> target="_blank"
Page: [1]
 
Zoqaeski

 

Posts: 11
Joined: 9/1/2004
From: Qelvetia
Status: offline

 
target="_blank" - 10/6/2004 8:20:10   
Is there a way to specify the target for links in CSS? In my web site that is under development, I got the pages validated by the tool on the w3c and html 4.xx strict doesn't support the target attribute. So that I can still have my external links open in a new window, can the target be specified in the CSS?
kkranjcec

 

Posts: 67
Joined: 1/15/2004
From: Croatia
Status: offline

 
RE: target="_blank" - 10/6/2004 9:20:02   
I'm usin JS for that purpose:

<script type="text/javascript">
function NewPage() {
if(!document.getElementsByTagName ) { return; }
var anchors = document.getElementsByTagName( "a" );
for( var loop = 0; loop < anchors.length; loop++ ) {
var anchor = anchors[ loop ];
if( anchor.getAttribute( "href" ) && anchor.getAttribute( "rel" ) == "external" ) {
anchor.target = "_blank";
}
}
}
</script>

And then in HTML code:

<body onload="NewPage()">

<a href="http://www.outfront.net/" rel="external">Outfront</a>

</body>

(in reply to Zoqaeski)
caz

 

Posts: 3468
Joined: 10/10/2001
From: Somewhere south of Chester, UK
Status: offline

 
RE: target="_blank" - 10/6/2004 13:47:35   
But, what if users have javascript disabled in their preferences, as many do?

_____________________________

Do not meddle in the affairs of cats, for they are subtle and will dance, or more on your keyboard.
Cheshire cat. www.doracat.co.uk

I remember when it took less than 4hrs to fly across the Atlantic.

(in reply to kkranjcec)
d a v e

 

Posts: 4010
Joined: 7/24/2002
From: England (but live in Finland now)
Status: offline

 
RE: target="_blank" - 10/6/2004 14:58:07   
you've just moved the target attribute into the javascript - just for the sake of validating, yet you're doing the same thing. either use target _blank and use a transitionla doctype for that page, live with that one 'error' on each page or then simply let users decide when they want a new window open. (shift+click will do it in IE and various way sin opera and moz)

_____________________________

David Prescott
Gekko web design

(in reply to caz)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: target="_blank" - 10/6/2004 15:17:21   
quote:

Is there a way to specify the target for links in CSS?

Nope

target="new" or target="_blank"

If W3C valid HTML is a concern... just don't open links in a new window...

(I'm no help at all am I?)


:)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to d a v e)
d a v e

 

Posts: 4010
Joined: 7/24/2002
From: England (but live in Finland now)
Status: offline

 
RE: target="_blank" - 10/6/2004 16:20:59   
i was in the same quandary and decided to remove my target attributes. it's better usability - at least as far as the likes of Jakob Nielsen are concerned, though i have my doubts about less experienced users knowing how to easily and quickly open new windows themselves. i don't think anyones is going to get confused if external pages don't open in a new window - at least without a user choosing to do so, though to help users from forgetting where the originating site (i.e. your site) was it would be nicer to open new windows so they don't have to hunt through their history.

_____________________________

David Prescott
Gekko web design

(in reply to bobby)
Page:   [1]

All Forums >> Web Development >> Cascading Style Sheets >> target="_blank"
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts