Search Tools

URL Reference Resolution and Same-Origin Check

Report an issue

Resolve a relative reference against a base URL and check whether it shares an origin with the comparison URL.

Uses the WHATWG URL model. It does not calculate RFC 3986-specific parsing results.

No requests are sent to the entered URLs, and no automatic navigation occurs. Do not enter credentials or secret query values.

Example: https://example.com/dir/page. Enter only URLs that are safe to disclose.

A blank value is resolved as an empty relative reference; the base URL's fragment is not retained.

Do not enter URLs containing usernames, passwords, tokens, or other secrets.

Results

Results update automatically when the required values are entered.

Method, applicability and sources

Calculation method

Resolution follows WHATWG URL behavior equivalent to new URL(reference, base). For ftp/http/https/ws/wss, origins are compared using normalized scheme, host, and port. Default ports (ftp:21, http/ws:80, https/wss:443) are omitted from the URL. Path, query, and fragment do not affect same-origin checks. Opaque origins such as file: are excluded.

Worked example (hypothetical values)

With base=https://example.com:443/dir/page, reference=../docs?lang=ja#top, and comparison=https://example.com/other, the resolved URL is https://example.com/docs?lang=ja#top and the origins match.

Applicability and limitations

URLs parsed by the URL API where the resolved and comparison URLs use ftp/http/https/ws/wss. Excludes RFC 3986-specific reference resolution, origin comparison for file/blob/data and similar URLs, URLs containing credentials or secret query values, actual HTTP connections, and CORS permission checks.

Method and sources

Method: WHATWG URL Living Standard (cross-checked 2026-11-14, URL API). Data recorded: 2026-11-14.