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