JavaScript cung cấp document object lấy chi tiết tài liệu. Có document.domain để lấy tên miền server tải tài liệu.
Ví dụ
Tài liệu tải trên server "tutorialspoint", domain là "www.tutorialspoint.com". Document.domain lấy domain tương ứng.
<html> <body> <p id="domain"></p> <script>
document.getElementById("domain").innerHTML = 'The domain name is: ' + " " + document.domain;
</script> </body> </html>
Kết quả
The domain name is www.tutorialspoint.com