Answers for "page url javascript"

5

get actual url in variable

var currentLocation = window.location;
Posted by: Guest on March-10-2020
3

javascript get domain

window.location.hostname
Posted by: Guest on April-12-2020
2

url in js

window.location.protocol = “http:”
window.location.host = “css-tricks.com”
window.location.pathname = “/example/index.html”
window.location.search = “?s=flexbox”const
postID = (new URLSearchParams(window.location.search)).get('post');
Posted by: Guest on August-30-2021
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
0

javascript url

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript</h2>

<h3>The window.location object</h3>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML = 
"The full URL of this page is:<br>" + window.location.href;
</script>

</body>
</html>
Posted by: Guest on March-04-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language