tag? I have a code something like this:

Is it possible to use a custom name in the "target" attribute of the <a> tag?

I have a 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 use only one.

So, I changed my code as follows:

 <a href="http://google.com" target="google">google</a> <a href="http://gmail.com" target="google">gmail</a> 

It worked! He creates a new window only at the first click of the link, and after that clicks on the links in this window.

I think this is good, but I can not find something about this in the W3C HTML 4 Spec . Is it valid and compatible with multiple browsers?

+7
source share
2 answers

Yes, thatโ€™s how you would use it in this instance. The value of the target attribute indicates where the linked document can be opened and can be one of _blank , _self , _parent , _top or framename , where frameename will be the name of the frame or window to use.

+8
source

Yes, it is absolutely correct and compatible with the browser. target indicates the name of the target window (or frame) that will be opened if it does not already exist.

The following have special meanings: _self , _blank , _parent , _top

Maybe you need a better HTML link .

+3
source

All Articles