|
|
| D: | Domains | Authors.aspalliance.com | Stevesmith | Articles | Opening Windows: _new or _blank? |
|
Opening Windows: _new or _blank? Many developers confuse the "_new" property with the "_blank" property when creating links to windows that they wish to have open in a new window. Consider the following two examples: <a href="http://www.aspalliance.com" target="_new">ASPAlliance (new)</a> <a href="http://www.aspalliance.com" target="_blank">ASPAlliance (blank)</a> At first glance, both of these links will have the same effect, which is to open a link to the ASPAlliance.com home page in a new window. To demonstrate, the two links are listed once more, as HTML: ASPAlliance (new)ASPAlliance (blank) Clicking on each of these has the same effect -- a new browser window is opened with the URL listed in the HREF property. But they're not really doing the same thing, and it is important to know which behavior you're actually trying to achieve. Having clicked on each of the above links once already, move the two new windows out of the way and click each link again. You will notice that the _new targeted link reloads the content of the window it already created, while the _blank targeted link creates another browser instance. What's Going On?The difference here is that _new is not really a valid target for an A HREF tag. However, it seems to make more intuitive sense to web developers and so is commonly used on many sites where _blank would seem to be the behavior desired. The _new attribute is treated as textual identifier for a window instance -- the window created is thereafter referred to as "_new". This can be a very useful behavior, allowing you to target links to various windows by name, but it is an important difference from the "_blank" reserved word. Using a target value of "_blank" will always create a brand new window. I would recommend against ever using "_new" as a target for a URL. It makes very little sense as an identifier, and is confusing. If you want a new window whenever the link is clicked, use "_blank"; if you want a single window to be created, give it a meaningful label by which to reference it. Remember that FRAME identifiers are also valid uses of the TARGET attribute. To learn more about the use of the TARGET attribute, consider the links below. Other Links: |
|
|
|
|
|
|
|