This is very basic and hot question asking every time in interview. How to get current page url in js? syntax :- window . location Location { href : "https://boyonweb.blogspot.com/2020/05/how-to-use-every-function-in-javascript.html" , ancestorOrigins : DOMStringList , origin : "https://boyonweb.blogspot.com" , protocol : "https:" , host : "boyonweb.blogspot.com" , … } ancestorOrigins : DOMStringList { length : 0 } assign : ƒ assign() fragmentDirective : FragmentDirective {} hash : " " host : " boyonweb.blogspot.com " hostname : " boyonweb.blogspot.com " href : " https://boyonweb.blogspot.com/2020/05/how-to-use-every-function-in-javascript.html " origin : " https://boyonweb.blogspot.com " pathname : " /2020/05/how-to-use-every-function-in-javascript.html " port : " " protocol : " https: " reload : ƒ reload() replace : ƒ replace() search : " ...