View Full Version : Targeting Links
JBottero
01-20-2008, 06:20 AM
Since the TARGET attribute has been depreciated from HTML, what is the preferred method of targeting a link at a new browser tab or window?
CSS or JavaScript?
I would so much like to believe that there is an alternative to JS.
I guess I really don't understand why such a useful thing as a link target would be depreciated out of basic HTML.
jscheuer1
01-20-2008, 11:18 AM
I'm with you, I think it is silly. You have three main alternatives:
Use a transitional DOCTYPE, target is valid there:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
so should continue to be supported with that DOCTYPE for many, many years to come.
Use target anyway and don't worry about validation. All major browsers support it. But since they are not required to for HTML 4.01 strict and above, it may lose support in the future, so this approach is not recommended.
The 'dreaded' javascript solution:
<a href="some.htm" onclick="window.open(this.href,'_blank');return false;">Some Link Text</a>
Any target may be used, _blank is shown.
Javascript really isn't so bad though. Users without javascript enabled may actually prefer your links open in the same window.
lovesafron
01-24-2008, 09:52 AM
Thanks you because i also got solution for my query.....
tech_support
01-24-2008, 10:05 AM
Yes, and what is it?
jscheuer1
01-24-2008, 04:50 PM
Yes, and what is it?
http://www.dynamicdrive.com/forums/showpost.php?p=127149&postcount=2
djr33
01-24-2008, 07:37 PM
From the reply, I infer that he found a different solution and was replying "[thanks anyway, for the suggestion, but I got another solution]".
In which case it would be a good idea to post that here, so we all can learn from it. Ask a question, get an answer, and everyone benefits. So, if you ask a question and figure out the answer, it's also just fair to post what you found so others can learn in the same way. Get help, give help, everyone gets help. Works well ;)
jscheuer1
01-24-2008, 08:25 PM
I think:
Thanks you because i also got solution for my query.....
Basically means:
Thanks. You answered my question too.
The:
i also [/too] got [the] solution for my query
seemed pretty clear to me, it doesn't say:
I got a different solution.
With such vague language, it is difficult to be certain, but it still seems pretty clear to me.
Why would the person thank me if I didn't help them?
djr33
01-24-2008, 08:35 PM
Ah, I suppose so.
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.