Back
All I want is to get the website URL. Not the URL as taken from a link. On the page loading, I need to be able to grab the full, current URL of the website and set it as a variable to do with as I please.
For getting the current URL with JavaScript you can use the following method:
window.location.href
You can also use document.URL; but it won’t work for Firefox.
You can also visit the following link for further knowledge URL of type DOMString, read-only.
31k questions
32.8k answers
501 comments
693 users