how to get the base domain url in javascript code example Example: js get base url var url = window.location.origin;