About This HTML Issue
The target attribute on the <area> element tells the browser where to display the linked resource — in the current tab, a new tab, a parent frame, or a named <iframe>. According to the WHATWG HTML living standard, a valid navigable target must be either a keyword beginning with an underscore (_self, _blank, _parent, _top) or a name that is at least one character long. An empty string ("") satisfies neither condition, so the W3C validator reports:
Bad value “” for attribute “target” on element “area”: Browsing context name must be at least one character long.
This commonly happens when templating engines or CMS platforms output target="" as a default, or when a value is conditionally set but the logic fails to produce a result.
Why this matters
-
Standards compliance. An empty
targetviolates the HTML specification and produces a validation error. -
Unpredictable browser behavior. While most browsers treat an empty
targetthe same as_self, this is not guaranteed by the spec. Relying on undefined behavior can lead to inconsistencies across browsers or future versions. -
Code clarity. An empty
targetsignals unclear intent. Removing it or using an explicit keyword makes the code easier to understand and maintain.
How to fix it
-
Remove the
targetattribute if you want the link to open in the same browsing context. This is the default behavior, equivalent totarget="_self". -
Use a valid keyword like
_self,_blank,_parent, or_topif you need specific navigation behavior. -
Use a named browsing context (e.g.,
target="contentFrame") if you want to direct the link to a specific<iframe>or window. The name must be at least one character long. -
Fix your template logic if the empty value is being generated dynamically. Ensure the
targetattribute is only rendered when a non-empty value is available.
Examples
Invalid: empty target attribute
This triggers the validation error because target is set to an empty string:
<img src="floor-plan.png" usemap="#rooms" alt="Floor plan">
<map name="rooms">
<area shape="rect" coords="10,10,100,60" href="/kitchen" alt="Kitchen" target="">
</map>
Fixed: remove target for default behavior
If you want the link to open in the same tab (the default), simply remove the target attribute:
<img src="floor-plan.png" usemap="#rooms" alt="Floor plan">
<map name="rooms">
<area shape="rect" coords="10,10,100,60" href="/kitchen" alt="Kitchen">
</map>
Fixed: use a valid keyword
Use _self to be explicit about same-tab navigation, or _blank to open in a new tab:
<img src="floor-plan.png" usemap="#rooms" alt="Floor plan">
<map name="rooms">
<area shape="rect" coords="10,10,100,60" href="/kitchen" alt="Kitchen" target="_self">
<area shape="rect" coords="110,10,200,60" href="/bedroom" alt="Bedroom" target="_blank">
</map>
Fixed: target a named <iframe>
If you want to load the linked resource into a specific <iframe>, give the <iframe> a name attribute and reference it in target:
<iframe name="detailView" src="about:blank" title="Room details"></iframe>
<img src="floor-plan.png" usemap="#rooms" alt="Floor plan">
<map name="rooms">
<area shape="rect" coords="10,10,100,60" href="/kitchen" alt="Kitchen" target="detailView">
</map>
Fixed: conditionally render target in templates
If your target value comes from a variable, make sure the attribute is only output when the value is non-empty. For example, in a Jinja-style template:
<area shape="rect" coords="10,10,100,60" href="/kitchen" alt="Kitchen"
{% if target_value %} target="{{ target_value }}"{% endif %}>
This prevents target="" from appearing in your HTML when no value is set.
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.