Referring page URL

wixLocation.url gives the url of the current page. How do I get the url of the referring page.
ie. if I have a link to page C from page A and page B, how do I know whether I came from page A or page B while I am in C?

I do this in the masterPage.js onReady()

let url = wixLocation . url ;
let prevUrl = local . getItem ( ‘prevUrl’ );
if ( url !== prevUrl ) {
:
:
local . setItem ( ‘prevUrl’ , url );
}

I also have code in my error404 page onReady() to get the url and prevUrl as follows:
let url = wixLocation . url ;
console . log ( ‘broken link=’ , url );
let prevUrl = local . getItem ( ‘prevUrl’ );
console . log ( ‘prev url =’ , prevUrl );

What I am not sure about is whether the masterPage onReady() will execute before or after the error404 page onReady() function.

Is there some other simple way to get the url of the referrer.

Hi,

If you would do a little search on wix you would have found it.
in this post :
https://www.wix.com/velo/forum/coding-with-velo/how-to-create-a-back-button-1

Ido answered it.
https://www.wix.com/velo/forum/main/comment/5a8ac264ebade10013d16155

Or the answer of Yisreal/
https://www.wix.com/velo/forum/main/comment/5c4efd2aeb7deb001d452800

Kind regards,
Kristof