Answers for "location object in javascript example"

1

javascript location object

// Prints complete URL
window.location.href
  
// Prints protocol like http: or https:
window.location.protocol 
 
// Prints hostname with port like localhost or localhost:3000
window.location.host
  
// Prints hostname like localhost or www.example.com
window.location.hostname
 
// Prints port number like 3000
window.location.port
  
// Prints pathname like /products/search.php
window.location.pathname
 
// Prints query string like ?q=ipad
window.location.search
 
// Prints fragment identifier like #featured
window.location.hash
Posted by: Guest on September-08-2020

Code answers related to "location object in javascript example"

Code answers related to "Javascript"

Browse Popular Code Answers by Language