isURLActive()function

isURLActive(target: PossibleURL | undefined, base: PossibleURL | undefined, caller: AnyCaller = isURLActive): boolean
ParamType
targetPossibleURL
URL whose status to test — relative paths resolve against base.
basePossibleURL
Base URL to test against.
callerAnyCaller
Function to attribute a thrown error to — defaults to isURLActive. Defaults to isURLActive
Return
boolean
true if target resolves to exactly the same URL as base, otherwise false.

Is a target URL active relative to a base URL?

  • Active means target and base resolve to the exact same URL (same origin, same path).
  • Origin mismatches return false.

Examples

isURLActive("http://x.com/a", "http://x.com/a"); // `true`