jquery, domain, get URL

前端 未结 11 2081
滥情空心
滥情空心 2020-12-12 10:04

How can I get the domain name with jquery ??

11条回答
  •  时光取名叫无心
    2020-12-12 10:40

    //If url is something.domain.com this returns -> domain.com
    function getDomain() {
      return window.location.hostname.replace(/([a-z]+.)/,"");
    }
    

提交回复
热议问题