v145 · Web APIs · Origin Equivalence Tester

Origin equivalence tester

Type two URLs and see whether they canonicalise to the same Origin. Pre-loaded traps — default port, trailing dot, case, scheme mismatch — show how Chrome's parser folds the input.

compare

compare
canonical A: canonical B:

code

const oa = Origin.parse(urlA);
const ob = Origin.parse(urlB);
const same = oa.isSameOrigin(ob);   // strict
const sameSite = oa.isSameSite(ob); // relaxed
console.log(oa.isOpaque);

see also