I have a webpage that alerts me the with the current .href of the website. However I want to be able to pass a short variable into the webpage when entering the domain name so that I later can use that in js.
For example going to website localhost entering: localhost/HelloWorld should alert "HelloWorld"
Is this possible?
This is my html code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Get Current URL in JavaScript</title>
</head>
<body>
<script>
function getURL() {
alert("The URL of this page is: " + window.location.href);
}
</script>
<button type="button" onclick="getURL();">Get Page URL</button>
</body>
</html>