Web/front-end
[javascript] JavaScript에서 URL host 이름 추출
hjkongkong
2022. 9. 14. 21:54
var root= window.location.protocol +'//'+window.location.host;
window.location.protocol = https:
window.location.host = www.google.com
port를 구분하지 않고싶다면
window.location.host대신 window.location.hostname를 사용한다.