isURLActive()function
isURLActive(target: PossibleURL | undefined, base: PossibleURL | undefined, caller: AnyCaller = isURLActive): boolean
| Param | Type | |
|---|---|---|
target | PossibleURL | URL whose status to test — relative paths resolve against base. |
base | PossibleURL | Base URL to test against. |
caller | AnyCaller | 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
targetandbaseresolve to the exact same URL (same origin, same path). - Origin mismatches return
false.
Examples
isURLActive("http://x.com/a", "http://x.com/a"); // `true`