最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Is the underscore in target="_blank" no longer needed? - Stack Overflow

programmeradmin1浏览0评论

Today I made a typo while helping someone with a question and wrote target="blank" instead of target="_blank". The interesting thing was that it still worked. I decided to try it out in other browsers as well to see if it was only Chrome that allowed for target="blank" without the underscore, but it seems to work in Firefox and Safari as well.

Is there a reason why the underscore can be dropped? And if it's legitimate to write it as target="blank", why do most if not all sources still say to write it out as target="_blank"?

Today I made a typo while helping someone with a question and wrote target="blank" instead of target="_blank". The interesting thing was that it still worked. I decided to try it out in other browsers as well to see if it was only Chrome that allowed for target="blank" without the underscore, but it seems to work in Firefox and Safari as well.

Is there a reason why the underscore can be dropped? And if it's legitimate to write it as target="blank", why do most if not all sources still say to write it out as target="_blank"?

Share Improve this question edited Apr 21, 2016 at 12:35 asked Apr 21, 2016 at 12:20 anonanon 0
Add a comment  | 

1 Answer 1

Reset to default 24

If you have target="blank", open it twice and it opens in the same window. If you have target="_blank" twice, it opens in two different windows. You can check using:

<a href="http://google.com/" target="blank">Google</a>
<a href="http://en.wikipedia.org/" target="blank">Wikipedia</a>

Same with, _blank opening in two different windows:

<a href="http://google.com/" target="_blank">Google</a>
<a href="http://en.wikipedia.org/" target="_blank">Wikipedia</a>

In simple terms, it would be considered as blank will be the name of the new window, while _blank is a special keyword, opens a new window without a name. Correct me if I am wrong.

发布评论

评论列表(0)

  1. 暂无评论