how to get data from the current page url in javascript in browser code example Example: javascript get current url var currentUrl = window.location.href;