PDA

View Full Version : <a href="#" target="_blank" is apparently naughty



RabBell
September 4th, 2007, 07:23 AM
I had another developer kinda tell me off the other day for using target="_blank" in an anchor tag. Apparently it's been depreceated.

So, what does everyone else use then?

:vader:

RabBell
September 4th, 2007, 08:18 AM
also tag on another question here. I just realised that if I wanted to call a js function from a link I would do this


<a href="#" onclick="jsfunction()">CLICK</a>

now I know using onclick is wrong. So again, how is this done nowadays?

another question as well. I seemed to have let myself slip a little in what some people would call modern XHTML/CSS. I mean I think I've a good knowledge about these subjects but I seem to be slipping in certain areas.

How do you guys keep on top of it?

icio
September 4th, 2007, 08:29 AM
It's still valid in XHTML < Strict.
http://w3schools.com/tags/tag_a.asp

I just let the user decide. It's so much easier to open new browser windows in modern browsers than it was back in the day of IE6 dominance (Middle-click over Shift+Click) and people are now much more used to having more than one browser window (or tab) open than they used to be.

I don't stay on top of it, I just accept it as above me :(

lab9design
September 4th, 2007, 12:00 PM
target="_blank"
Yep - exactly as Icio says, you should not force user action in anyway, but instead allow them the option of how they want to open the link.
If you feel that you must use it, but still want valid xhtml, then you will have to use the transitional doctype instead I suppose.

As for keeping on top of things? Well, regular and diverse reading (both online and off) ... time consuming, but necessary. I'll see if I can find any decent links :)