The URL read-only property of the Document interface returns the document location as a string.
var string = document.URL
document.getElementById("urlText").innerHTML = "URL: " + document.URL; <p id="urlText">URL goes here.</p>
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/document/URL