Location.hostname : Location : Location JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Location » Location »

 

Location.hostname







The hostname property represents the hostname portion of the URL.












<html>
    <head>
    <title> Using the hostname property of the Location object</title>
    </head>
    <body>
    <script language="JavaScript">
    <!--
    function show(){
         alert(document.location.hostname);
    }
    -->
    </script>
    <form name="form1">
    Click the button to get the current location.hostname
    <br>
    http://www.navioo.com
    <br>
    <input type="button" name="gethost" value="Get hostname" onClick='show()'>
    <br>
    </form>
    </body>
    </html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Location
» Location