Suppose i have alot a link like the below , it makes sense to add the attribute target="_blank" , but what if i have 10 o
f these kind of links , should i than add that attribute to the 10 links using JS ?? is that a better idea , i think that will help keep my HTML doc clean
good idea ? bad idea ?
<a href="abc.com" target="_blank"><i class="icon fa fa-google-plus"></i></a>
IMO
Using the target attribute for forcing a new window or tab is a Bad Idea. It only pisses off your visitor and clutters his browser. The target attribute was deprecated in 1999 except for use in frames. Unfortunately, html5 is bringing it back due to the silly concept of paving the cowpath; anything that people use or browsers support for legacy reasons is being made valid. this is the reason html got so messy in the first place.
If you're going to do that silliness anyway, you could always simply paste the attribute/value into the various 'a' elements willy-nilly.
You may have got the idea that I am not a fan of developers' sending me to a new window or tab. If I, or any user wants the link to open in a new tab, we can do it ourselves. We don't need to be forced.
cheers,
gary
What he says! If you really
What he says!
If you really have to do this and lord knows everyone wants to nowadays - so much for a decade of establishing Standards and best practises - do so via JS, jQuery makes this easy set anchors with a class 'new-win' and use that to set the elements with the target attribute
Thanks Gary and Hugo !
Yes i taught so JS would be a good option . Thanks @gary and @Hugo ! (: