javascript get base url of current page js code example Example: javascript get base url console.log(window.location.origin);