Javascript Referrer
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.
Free Copy and Paste Javascript Code:
<script type="text/javascript">
<!--
if (!document.referrer) {
document.write("No referrer, pal.")
}
else {
document.write(document.referrer);
}
-->
</script>
Resources:
Javascript Print
HTML Tutorials
Javascript If Else
Javascript Alert
Onclick Javascript
Javascript Reset
Javascript onBlur
Javascript Query String
Javascript innerHTML
Javascript Focus
Javascript SelectAll
Javascript Close Window