Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>window.location function</title> </head> <body> <p id="demo"></p> <script> document.getElementById("demo").innerHTML = "URL: " + window.location.href + "</br>"; document.getElementById("demo").innerHTML = document.getElementById("demo").innerHTML + "Hostname: " + window.location.hostname + "</br>"; document.getElementById("demo").innerHTML = document.getElementById("demo").innerHTML + "Protocol: " + window.location.protocol + "</br>"; </script> </body> </html>