How to obtain Domain name via JavaScript? [duplicate]

If you are asking about the machine name of the host that served up the current page, you can find that with

window.location.hostname

If you are asking about the name of the machine that is displaying the page in a browser, that information is restricted by browsers for security purposes.

Leave a Comment

tech