Get the URL of a URL field:
var x = document.getElementById("myURL").value;
Click the button to display the URL of the URL field.
elements with type="url" are not supported in Safari.
<!DOCTYPE html> <html> <body> Homepage: <input type="url" id="myURL" value="http://www.google.com"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w.j a va2 s . com*/ var x = document.getElementById("myURL").value; document.getElementById("demo").innerHTML = x; } </script> </body> </html>