0

I'm trying to find the sub-URL (e.g., '/page') of the previous page in my sveltekit website.

I tried the code below but its not working. Is there a way to get the previous page perhaps using sveltekit's in-built exports like $page?

if (browser) {
        let previousUrl = document.referrer.substr(previousUrl.lastIndexOf('/') + 1);
    }

0 Answers0