A recent project, repeatedly encountered target = '_ self', target = '_ blank' usage, again, to sum up:
1. <a> label
<a href="xxxx" target="_self">XX</a>
<a href="xxxx" target="_blank">XX</a>
2. <form> tag
<Form name = alipayment action = alipayapi.jsp method = post target = "_ blank"> (the tag from demo Alipay)
3.window.open
var url =xxxx;
window.open(url,'_self');
(window.location.href=xxx;)
We met three uses target in the same project.
All target values and their meanings:
_blank: open in a new window;
_self: default. Opens in the same frame;
_parent: concentrated opens in the parent frame;
_top: Open the entire window;
In fact, we rarely use the frameset tag, so in general we just often use target = '_ self' and target = '_ blank', respectively, for the current page open, and open a new page.
Note :
In HTML 4.01, the target property is deprecated form element; in XHTML 1.0 Strict DTD, the property is not supported.
window.open with window.location.href difference:
window.open () to open a new window, but with '_self', can achieve the effect of using window.location.href
window.location.href to replace this page, this page is relocated
window.open () can open a website address another on a website
and window.location.href is only open on this site in a website