# Bad value “” for attribute “target” on element “area”: Browsing context name must be at least one character long.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-for-attribute-target-on-element-area-browsing-context-name-must-be-at-least-one-character-long
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

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](https://html.spec.whatwg.org/multipage/document-sequences.html#valid-navigable-target-name-or-keyword), 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 `target` violates the HTML specification and produces a validation error.
- **Unpredictable browser behavior.** While most browsers treat an empty `target` the 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 `target` signals unclear intent. Removing it or using an explicit keyword makes the code easier to understand and maintain.

### How to fix it

1. **Remove the `target` attribute** if you want the link to open in the same browsing context. This is the default behavior, equivalent to `target="_self"`.
2. **Use a valid keyword** like `_self`, `_blank`, `_parent`, or `_top` if you need specific navigation behavior.
3. **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.
4. **Fix your template logic** if the empty value is being generated dynamically. Ensure the `target` attribute 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:

```html
<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:

```html
<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:

```html
<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`:

```html
<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:

```html
<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.
