Html target="_blank" 和 target="blank" 有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35703005/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 19:00:35  来源:igfitidea点击:

What is the difference between target="_blank" and target="blank"?

htmlhyperlink

提问by Borja

Since I approached the web programming, to open a link in a new window I always used

自从接触网络编程以来,我一直使用在新窗口中打开链接

target="blank"

but most of the time, here and in the rest of the web I have ever seen use:

但大多数时候,在这里和网络的其余部分我见过使用:

target="_blank"

Both forms work (of course), but I do not know the difference between the two versions and they do not know what the correct way (and why)....

两种形式都有效(当然),但我不知道这两个版本之间的区别,他们也不知道正确的方法(以及为什么)......

I hope you can understand me. Thanks and sorry for my English.

我希望你能理解我。感谢和抱歉我的英语。

回答by Quentin

blanktargets an existing frame or window called "blank". A new window is created only if "blank" doesn't already exist.

blank目标是一个名为“空白”的现有框架或窗口。仅当“空白”不存在时才创建新窗口。

_blankis a reserved name which targets a new, unnamed window.

_blank是一个保留名称,它针对一个新的、未命名的窗口。

回答by TommyWhite

In short, use target="_blank"it always open a new window but use target="blank"it will open a new window at the first time and this window will be reused after the first.

简而言之,使用target="_blank"它总是打开一个新窗口,但使用target="blank"它会在第一次打开一个新窗口,并且这个窗口在第一次之后会被重用。