Javascript examples for DOM:Document URL
The URL property returns the full URL of the current HTML document.
A String, representing the entire URL of the document, including the protocol (like http://)
The following code shows how to get the full URL of the current HTML document:
<!DOCTYPE html> <html> <body> <p>Click the button to display the URL of the document.</p> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w . ja va 2 s. c om*/ var x = document.URL; document.getElementById("demo").innerHTML = x; } </script> </body> </html>