using JS to get the users current URL and store for use later code example
Example 1: get actual url in variable
var currentLocation = window.location;
Example 2: current url
window.location.href
var currentLocation = window.location;
window.location.href