Location.protocol : Location : Location JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Location » Location »

 

Location.protocol









The protocol property represents the protocol portion of the URL.

This is located in the beginning of the URL address (the text before ://).

For example, the protocol for http://www.navioo.com is http: and the protocol for ftp://www.yourserver.com is ftp:.












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







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Location
» Location