Get the domain name with port number in javascript var arr = window.location.href.split(“/”); var url = arr[0] + “//