I have a javascript code where I update a (full-)URL string to get the relative path only:
const url = 'http://www.example.com/map/123'.replace(window.location.origin, "");
console.log(url);
This code, when running on http://www.example.com, would log /map/123.
It works fine on my computer, but I noticed that on my Ipad and on my Android phone, the origin is not stripped.
Is window.location.origin not compatible with all browsers ? And in that case, how should I handle this ?
Thanks