How to get URL in window javascirpt code example Example: javascript get current url var currentUrl = window.location.href;