The question about target="_blank" stay and will be discussed many times online. Some say they need to keep, and some say they need to remove them. The party who advocates stay mainly considers the attribute of target="_blank" currently, there is no good way to solve it, while the party who advocates going has come up with rel and JS solutions. I think there are still many people in a blind spot at the moment. I looked up the relevant literature and found that the situation was not what we thought. In fact, target="_blank" is not inconsistent with the standards, and it is also unnecessary to use rel and JS solutions, because this is a misunderstanding. As long as we understand the true meaning of rel and target, we will know that there should not be any dispute here. Below I will share with you the knowledge I have obtained through searching the literature. Let’s first understand the meaning of target and rel:
target , agrees to specify where to display the selected hyperlink content. That is to say, the content of the link will be displayed in what kind of window. The property value of target has four reserved names, namely: _blank,_self,_parent,_top. where _blank means that the browser always loads the document with the target="_blank" link in a newly opened, unnamed window. Here you may not understand what "unnamed" means. In fact, target can assign an ID to the newly opened window, for example: target="name" This means that the document loaded through the target="name" link will be displayed in a window called "name". If there is no window with ID "name", the browser will create a new window named "name" to display the linked document. If the ID of the current window is "name", then the linked document will be displayed in the current window by replacing the original content. The meaning of _self is actually the current document. The default goal of <a> is _self. This property value is generally not available. _parent is to make the linked document display in the parent window. This property value is only used in the framework structure. If it is a top-level framework, its function is the same as _self. _top is also applied in the framework, but its effect is to clear the framework to display the target document. This is very useful for moving from frame structure to frameless structure.
Now we know that target is a target display property that is closely related to the browser. So what is rel? Why do many people regard it as a replacement attribute of target? Let’s get to know rel. In fact, there is not only one rel and another corresponding attribute called rev. The meaning of these two attributes is: the relationship from the source document to the target document; the relationship from the target document to the source document. The source document here can be understood as the current document where the link is located, and the target document is the document that the link will open. Now we should be clear that rel and rev are actually a link relationship before the document, not a browser-related attribute of how to display the target document.
So what is the relationship between rel and rev? The following will list and explain the meaning of it:
Sample code [www.CuoXIn.com]