URL Protocol

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

Description

The URL scheme identifies the syntax or access method, such as HTTPS, mailto or data.

The URL scheme identifies the syntax or access method, such as HTTPS, mailto or data. The protocol property includes the colon and is normalized by the URL parser.1

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

When to use URL Protocol

Use this tool to extract the protocol of an absolute URL using the WHATWG URL parser, including its normalization rules.

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 Protocol 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 protocol. 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
urlAbsolute URL to parse.string; maximum length: 1000000Required

Provide an absolute URL and read its normalized scheme with a trailing colon, for example https:. The tool uses the WHATWG constructor without a base; scheme case is normalized. Other components are parsed but not returned.

protocol=WHATWG_URL(url).protocol

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

Output fieldMeaningValue type
protocolNormalized URL protocol.string; maximum length: 1000000
json
{
  "input": {
    "url": "https://reader:secret@EXAMPLE.com:8443/a/../guide?q=one&q=two#part"
  },
  "output": {
    "protocol": "https:"
  }
}

Limitations and assumptions

A parseable scheme does not mean the current application supports it or that a connection is secure. No network request or scheme allowlist is applied.

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.

Alternative or Complementary methods

Use URL Is Absolute: Check whether a reference parses as an absolute WHATWG URL. For a complementary task, use URL Is Data: Check whether an absolute WHATWG URL uses the data scheme.

References

  1. URL Protocol — tool.io

Similar or alternative tools

  • URL Is Absolute

    Check whether a reference parses as an absolute WHATWG URL.

  • URL Is Data

    Check whether an absolute WHATWG URL uses the data scheme.

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