Answers for "javascript get referrer page url"

5

jquery get current url

var currentURL = $(location).attr('href'); //jQuery solution
var currentURL = window.location.href; // raw javascript
Posted by: Guest on July-23-2019
0

javascript get referrer

// website2.html
<img src="website3.com/pxl.gif" id="pxl" />
<script>
document.getElementById('pxl').src += '?ref=' + encodeURIComponent(document.referrer);
</script>
Posted by: Guest on August-11-2020
0

javascript hashtag url

var hash = window.location.hash;
if (hash) {
  // Fragment exists
  hash = hash.substring(1);
  console.log(hash);
} else {
  // Fragment doesn't exist
}
Posted by: Guest on February-27-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language