Location



Write a javascript code to get a pathname.


<html>            
  <head>
    <script>
    
    function displayFunction() 
    {
        document.getElementById("para").innerHTML+="The webpage is located at:"+window.location.pathname;
    }

    </script>
  </head>
<body>
    
    <p>Click to get The Path of the Web Page</p>
    <input type="button" value="Get the Path" onclick="displayFunction();"/>
    <p id="para"></p>

  </body>
</html>

Output: