How to get parent URL in JS without using document.referrer

104 Views Asked by At

I need to get the parent url which redirect to current page using JS, I find document.referrer can achieve, but our company has some security rules said can't trust that the referrer header is safe - it can be spoofed, omitted, or have an unexpected format.

I am asking are there any other way to achieve this? Thanks!

1

There are 1 best solutions below

0
On

The other way I know of is looking into the window object

window.location.origin