URL Is Data

Check whether an absolute WHATWG URL uses the data scheme.

Description

A data URL embeds a payload in the URL text.

A data URL embeds a payload in the URL text. Identifying the scheme is a lighter check than decoding or validating that embedded payload.1

Check whether an absolute WHATWG URL uses the data scheme.

When to use URL Is Data

Use this tool to check whether an absolute WHATWG URL uses the data scheme.

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 Data 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 to classify.string; maximum length: 1000000Required

Paste a URL string. The tool tries absolute parsing and compares its normalized protocol to data:. Valid other schemes, relative input and parse failures return false as successful classification results. A data URL with malformed payload syntax can still return true.

result=absoluteParsingSucceeds && protocol==='data:'

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

Output fieldMeaningValue type
resultWhether the URL uses the requested scheme.boolean
json
{
  "input": {
    "url": "data:text/plain,hello"
  },
  "output": {
    "result": true
  }
}

Limitations and assumptions

This does not check a comma separator, media type or Base64 validity. Missing or wrongly typed tool fields are input errors, distinct from a false classification.

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 Data URL Parser: Parse a data URL into its media-type declaration, Base64 flag, and decoded byte sequence without guessing a text encoding. For a complementary task, use URL Protocol: Extract the protocol of an absolute URL using the WHATWG URL parser, including its normalization rules.

References

  1. URL Is Data — tool.io

Similar or alternative tools

  • Data URL Parser

    Parse a data URL into its media-type declaration, Base64 flag, and decoded byte sequence without guessing a text encoding.

  • URL Protocol

    Extract the protocol 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