URL Is Relative

Check whether a reference needs a base URL and resolves against a hierarchical HTTPS base.

Description

A relative URL reference requires a base to resolve.

A relative URL reference requires a base to resolve. A string that fails absolute parsing is not necessarily a valid relative reference, so the tool checks both conditions.1

Check whether a reference needs a base URL and resolves against a hierarchical HTTPS base.

When to use URL Is Relative

Use this tool to check whether a reference needs a base URL and resolves against a hierarchical HTTPS base.

Choose the URL, decoded source text, header value or explicit byte list requested by this tool. Paste the complete relevant input and follow its parsing and encoding conventions.

How to use URL Is Relative and understand its results

  1. Choose the URL, decoded source text, header value or explicit byte list requested by this tool. Paste the complete relevant input and follow its parsing and encoding conventions.
  2. Enter url using the field table and calculation rules, then run the tool.
  3. Read result. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
urlURL reference to classify.string; maximum length: 1000000Required

Paste the reference, including paths, query-only or fragment-only forms. The tool first tries absolute parsing and then resolution against https://example.invalid/. It returns true only when the first fails and the second succeeds. An empty string is a resolvable relative reference.

result=!parsesWithoutBase && parsesAgainstHTTPSBase

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
resultWhether the reference matches this URL class.boolean
json
{
  "input": {
    "url": "../assets/icon.svg"
  },
  "output": {
    "result": true
  }
}

Limitations and assumptions

This classifies against one hierarchical HTTPS base without returning a resolved URL. A false result may be absolute or unparseable; it does not fetch the artificial base.

Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors. A successfully returned false flag is an evaluated outcome; its meaning is explained above.

Alternative or Complementary methods

Use URL Is Absolute: Check whether a reference parses as an absolute WHATWG URL. For a complementary task, use URL Pathname: Extract the pathname of an absolute URL using the WHATWG URL parser, including its normalization rules.

References

  1. URL Is Relative — tool.io

Similar or alternative tools

  • URL Is Absolute

    Check whether a reference parses as an absolute WHATWG URL.

  • URL Pathname

    Extract the pathname of an absolute URL using the WHATWG URL parser, including its normalization rules.

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