URL Origin

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

Description

An origin represents the scheme, host and effective port for supported URL schemes.

An origin represents the scheme, host and effective port for supported URL schemes. Schemes with opaque origins serialize that origin as the literal string null.1

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

When to use URL Origin

Use this tool to extract the origin 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 Origin 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 origin. 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

Enter an absolute URL. Return its serialized origin, with host normalization and default-port omission. Path, credentials, query and fragment are excluded. An opaque origin yields the string null rather than a missing value or JSON null.

origin=WHATWG_URL(url).origin

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

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

Limitations and assumptions

Blob origin serialization follows the platform URL rules; this does not inspect blob availability. An origin string alone does not establish browser access permissions, trust or reachability.

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 Host: Extract the host of an absolute URL using the WHATWG URL parser, including its normalization rules. 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 Origin — tool.io

Similar or alternative tools

  • URL Host

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

  • 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