javascript url move to new base address code example Example: js get base url var url = window.location.origin;