How to get previous URL (document.referrer)?
@Patrick Mast
Thanks @Lucas G ! I want to use this in my 404 page to help redirect users to the correct page if they make a typo . For example , let 's say the correct URL is https://example.com/support , but the user enters https://example.com/suport . This would usually result in a 404 page error . On the 404 page , I need to capture the "previous " page URL , https://example.com/suport , so that I can automatically redirect the user to https://example.com/support . Another use case for this is building a short links service . When a user enters https://shorturl.com/e62waq , we need to capture the "e62waq " part of the URL on the 404 page , so we can look up and redirect to the corresponding long URL .

.jpeg/public)