Get URL of where I'm located with JavaScript


How do I get the current URL on the website? using javascript .

What I want is to know if I can obtain the url of a website, but for example if I am in the /conocenos section /conocenos want to obtain http://sitioWeb/conocenos .


in javascript you can get the url with: location.href

<script type="text/javascript">

from window.location

   <script type="text/javascript">

In summary you can use:

window.location.href : get the href (url) of the current page.

Scroll to Top