I have code something like this:
<a href="http://google.com" target="_blank">google</a>
<a href="http://gmail.com" target="_blank">gmail</a>
Whenever I click one of the links, a new window or tab is created. I wanted the links to just use one.
So I changed my code like this:
<a href="http://google.com" target="google">google</a>
<a href="http://gmail.com" target="google">gmail</a>
It worked! It makes a new window just the first time either link is clicked, and after that clicks on the links appear in that window.
I think this is good, but I cannot find something about this in the W3C HTML 4 Spec. Is it valid and cross-browser compatible?
Yes, that’s exactly how you would use it in this instance. The value of the
targetattribute specifies where to open the linked document and can be one of_blank,_self,_parent,_top, orframename, where framename would be the name of the frame or window to use.