LX DevBlog

About

Browser URL’s

12/16/2024
Javascript
url = "http://127.0.0.1:80/index.html"

console.log(location.href)
/* http://127.0.0.1:80/index.html */

console.log(location.protocol)
/* http: */

console.log(location.hostname)
/* 127.0.0.1 */

console.log(location.port)
/* 80 */

console.log(location.pathname)
/* /index.html */