Forum Moderators: open
That's a good question and one that got some good answers in this thread:
[webmasterworld.com...]
6.16 Frame target namesThe following target names are reserved and
have special meanings._blank :: The user agent should load the designated
document in a new, unnamed window._self :: The user agent should load the document in
the same frame as the element that refers to
this target._parent :: The user agent should load the document
into the immediate FRAMESET parent of the current
frame. This value is equivalent to _self if the
current frame has no parent._top :: The user agent should load the document
into the full, original window (thus canceling
all other frames). This value is equivalent to
_self if the current frame has no parent.W3C Reference [w3.org]
You'll notice that "new" is not on this list, so what is happening in the browser when you write target="new"?
16.3.2 Target semanticsUser agents should determine the target frame
in which to load a linked resource according
to the following precedences (highest priority
to lowest):1. If an element has its target attribute set
to a known frame, when the element is activated
(i.e., a link is followed or a form is processed),
the resource designated by the element should be
loaded into the target frame.2. If an element does not have the target
attribute set but the BASE element does, the BASE
element's target attribute determines the frame.3. If neither the element nor the BASE element
refers to a target, the resource designated by
the element should be loaded into the frame
containing the element.4. If any target attribute refers to an
unknown frame F, the user agent should create a
new window and frame, assign the name F to the
frame, and load the resource designated by the
element in the new frame.W3C Reference [w3.org]
So the browser is creating a new window that contains a single frame with the name "new". If the user then clicks on another link with target="new" it will load in that same frame. But every time a link with target="_blank" is clicked on, it will ALWAYS open a new window, and never load in an already open window.
Also note that the target attribute is not valid in either HTML 4.01 strict or XHTML 1.1 strict. However, there is a transitional DTD for HTML 4.01, and a frameset DTD for XHTML 1.1 and both of these DO allow the target attribute. However, if you are not creating a frameset website, then a strict DTD will not validate with a target attribute.
Also, see this rather thorough discussion. It may help you figure out this mess (and it is a mess, IMO):
[webmasterworld.com...]
Okay, it dodges the validator, but if the validator could detect it, I'm pretty sure it would still say - XHTML strict does not allow markup to describe new window behaviour, only page structure, so that attribute is still invalid.
Given this, is there any way to combine CSS and Javascript to simulate target="_blank"?
That may be a daft question... is there actually any way to combine CSS and Javascript at all?