base href Single Instance Warning

Reports multiple base elements with href attributes and the first such href in document order. Include empty href attributes in the vector. This checks cardinality and selection only, without URL resolution or base target attributes.

Description

A base href influences relative URL resolution in a document.

A base href influences relative URL resolution in a document. Multiple base elements with href can obscure which declaration controls that behavior.1

Reports multiple base elements with href attributes and the first such href in document order. Include empty href attributes in the vector. This checks cardinality and selection only, without URL resolution or base target attributes.

When to use base href Single Instance Warning

Use this for the following task: Reports multiple base elements with href attributes and the first such href in document order. Include empty href attributes in the vector. This checks cardinality and selection only, without URL resolution or base target attributes.

Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.

How to use base href Single Instance Warning and understand its results

  1. Prepare the parsed attribute values, element states or ordered local lists requested below. Keep attribute presence separate from value.
  2. Enter hrefs using the field table, then run the tool.
  3. Read count, hasBase, multiple, firstHref. Interpret flags, units, ordering and placeholder values using the rules below.
  4. Review any reported issue or failed check, correct the supplied values when appropriate, and verify the result in its intended context.
Input fieldMeaningValue type and boundsRequirement
hrefsHrefslist of string; minimum entries 0; maximum entries 10000; each entry: string; maximum text length 10000Required

Supply href attributes in document order, including empty attributes. Return cardinality and the first value without resolving it.2

count = hrefs.length; firstHref = hrefs[0] or empty string; multiple = count > 1

This summarizes the declared operation. Units, indexing, inclusivity and exceptional cases are explained in the surrounding text.

Output fieldMeaningValue type
countCountinteger
hasBaseHas Baseboolean
multipleMultipleboolean
firstHrefFirst Hrefstring
json
{
  "input": {
    "hrefs": [
      "/docs/",
      "/other/"
    ]
  },
  "output": {
    "count": 2,
    "hasBase": true,
    "multiple": true,
    "firstHref": "/docs/"
  }
}

Limitations and assumptions

This does not parse URLs, inspect base target or fetch a document. Empty firstHref can mean an empty first value or no base; inspect hasBase.

This evaluates supplied local information; it does not fetch a page or run a browser. Malformed requests produce input errors. A successfully evaluated request can still contain false flags, empty result lists or a result outside the supplied threshold; those outcomes have the meanings stated above.

Alternative or Complementary methods

Choose Open Graph Required Tags Check for this operation: Finds missing Open Graph basic metadata properties in supplied parallel property and content vectors. Requires nonempty content; it does not fetch images or validate URLs. For a complementary task, use data-* Attribute Naming Validator for this operation: Validates a namespace-less DOM data-* attribute local name and derives its dataset property name. Supply the DOM name after any HTML parser lowercasing.

Further background: HTML / accessibility reference: base href Single Instance Warning.

References

  1. HTML / accessibility reference: base href Single Instance Warning — WHATWG

  2. base href Single Instance Warning — tool.io

Similar or alternative tools

  • Open Graph Required Tags Check

    Finds missing Open Graph basic metadata properties in supplied parallel property and content vectors. Requires nonempty content; it does not fetch images or validate URLs.

  • data-* Attribute Naming Validator

    Validates a namespace-less DOM data-* attribute local name and derives its dataset property name. Supply the DOM name after any HTML parser lowercasing.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies