KW Online Tools Zone
Knowledge Walls
View All Tools Home
HOW TO GET CURRENT WEB PAGE URL HOSTNAME PORT PROTOCOL AND URI IN JAVASCRIPT
[Javascript editor]
Run
Share Link
Clear
HTML [Ctrl+Enter] - to run
CSS [Ctrl+Enter] - to run
Javascript [Ctrl+Enter] - to run
document.write("URL: "+window.location.href); document.write("
"); document.write("PROTOCOL: "+window.location.protocol); document.write("
"); document.write("HOST NAME: "+window.location.hostname); document.write("
"); document.write("PORT: "+window.location.port); document.write("
"); document.write("WEB PAGE URI: "+window.location.pathname); document.write("
");
OUTPUT
Copyright © 2021 Knowledge walls, All rights reserved
Copyright © 2021 Knowledge walls, All rights reserved