If you speak another programming language, note that Javascript actually spells referrer correctly, not referer. Two Rs in the Javascript referrrer.
Anyway, get it like so:
gy=document.referrer;
document.write(gy);
-We created a variable and named it gy because we like short variable names.
-We grabbed the referring URL with Javascript's built-in document.referrer object and stored it into gy
-We used Javascript's built-in document.write command to print the referrer to the browser.
NOTE: To test this script, you'll need to point another HTML page to the HTML page this script is on. Otherwise, the referrer will be empty.
NOTE: The ! exclamation point just before document.referrer in the following script means: if "there is not a" document.referrer.