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