showing results for - "javascript location object"
Lucia
03 Oct 2020
1// Prints complete URL
2window.location.href
3  
4// Prints protocol like http: or https:
5window.location.protocol 
6 
7// Prints hostname with port like localhost or localhost:3000
8window.location.host
9  
10// Prints hostname like localhost or www.example.com
11window.location.hostname
12 
13// Prints port number like 3000
14window.location.port
15  
16// Prints pathname like /products/search.php
17window.location.pathname
18 
19// Prints query string like ?q=ipad
20window.location.search
21 
22// Prints fragment identifier like #featured
23window.location.hash