Answers for "How to print browser url in Javascript?"

2

How to print browser url in Javascript?

// If 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
Posted by: Guest on April-09-2022

Code answers related to "How to print browser url in Javascript?"

Code answers related to "Javascript"

Browse Popular Code Answers by Language