URL의 호스트 이름 부분을 추출하려면 호스트 이름 방법을 사용하십시오.
예시
라이브 데모
<!DOCTYPE html>
<html>
<body>
<script>
var url = new URL("https://example.com/asdf/asdf/sadf.aspx?blah");
document.write(url.hostname);
</script>
</body>
</html> URL의 호스트 이름 부분을 추출하려면 호스트 이름 방법을 사용하십시오.
라이브 데모
<!DOCTYPE html>
<html>
<body>
<script>
var url = new URL("https://example.com/asdf/asdf/sadf.aspx?blah");
document.write(url.hostname);
</script>
</body>
</html>