How to get the URL of the document that loaded the current document in JavaScript

1 Answer

0 votes
<!DOCTYPE html>
<html>
<body>

<p id="pid"></p>

<script>
document.getElementById("pid").innerHTML = document.referrer;

/*
run:

https://jsfiddle.net/rjf3xps6/

*/
</script>

</body>
</html>

 



answered Jan 11, 2019 by avibootz
...