Do I have to change my document type if I want to keep the target attribute?
I want links to open in new windows.
I can’t seem to find an alternative code for it.
If you want to use the target attribute then yes you will need to change doctypes.
Maybe you want your links to open in new windows but have you stopped to think that the majority of your visitors will not. Put yourself in their position, have you ever been on a site that has links opening up in new windows, it’s irritating isn’t it. I get the feeling that they think I’m going to lose my way back to their site. The user should be the one to decide if they want a new window. There are plenty of times (especially when I have a search page open in google) that I DO WANT a new tab or window. In that case I right click and choose how I want to open it.
If you want to keep a strict DTD and you think you absolutely have to force a new window on the user then js will be your next best alternative. Have a read through these articles.
For now, I’m going to take those target attributes out. It’s now certified as a strict XHTML doctype by W3C. Whooo! Thanks, Rayzur. I appreciate all your help in this thread. You guys are a real godsend here. I always used that target attribute because of my background in internet marketing. I don’t do much of that anymore, though. So it’s an old habit. I was always under the impression that if you don’t open outgoing pages in a new window, you’ve now lost that visitor to someone else’s website. They may not return. But with a site like this one, with no ads, I don’t think that’s an issue.
I was always under the impression that if you don’t open outgoing pages in a new window, you’ve now lost that visitor to someone else’s website. They may not return.
Meh, depends on if your visitors are all IE6 users (no tabs) or not. Nowadays many of the browsers turn new windows into new tabs out of the box anyway. Back when the majority of the web had links as new windows, and browsers only had a new window as that option, what you learned in marketing was more correct. Nowadays the emphasis is on, let visitors decide how to deal with links and that they DO use the back button.
I guess the absolute worst thing is mixing the two. If I’m on a site that opens everything in a new window/tab (like SitePoint) I can get used to ctrl-w-ing everything, but then comes a link that just goes forward, and I’m already used to ctrl-w and whoops! Just closed everything dammit now I don’t remember where I was etc…
Conversely if I’m on a page that’s mostly regular links and then I get a new window link in one of my other browsers where I don’t have tabs-as-default set up, I don’t notice there’s a new window and when I’m done and close everything there’s like another browser still open and I’m like wtf did that come from? and then I lose hair.
There can be a good idea for when someone’s clicking a link while in the middle of doing something, like filling out a form… tho then having the new window be smaller and look like a popup makes more sense I think.