Copy link to clipboard
Copied
Hello, all,
I'm feeling kind of foolish for asking this, but I've been tasked by my boss.
We all know that in CF, one can access the remote hostname of the client system that is visiting a site/app. If it's not immediately available, one can also do a reverse DNS lookup. Even then, it's no guarantee that a valid value will be returned.
I think I already know the answer to this, but I need to make sure.
Is there a way to retrieve a client hostname in JavaScript?
(There, I said it. I'm not proud.)
V/r,
^ _ ^
You should never feel foolish for asking anything! That's how I've learned almost everything I know.
To the best of my knowledge, that will not be available from within the browser by default. Javascript is sandboxed enough that it's not going to be able to ask the host OS for the hostname.
And even if it was, it wouldn't necessarily be a "canonical" value. Most desktop computers within a LAN aren't going to know their own real hostname, because they're sitting behind a firewall that does network
...Copy link to clipboard
Copied
You should never feel foolish for asking anything! That's how I've learned almost everything I know.
To the best of my knowledge, that will not be available from within the browser by default. Javascript is sandboxed enough that it's not going to be able to ask the host OS for the hostname.
And even if it was, it wouldn't necessarily be a "canonical" value. Most desktop computers within a LAN aren't going to know their own real hostname, because they're sitting behind a firewall that does network address translation. So, for example, my desktop right now says its hostname is "DESKTOP-SQJ33T97" or something like that, because I'm working at home and I'm not doing anything to change internal network hostnames. But if I were connected to my office VPN, and went to your site, my IP address would be whatever the VPN assigned and the hostname would correspond to that address (home-gw.figleaf.com for example).
Dave Watts, Eidolon LLC
Copy link to clipboard
Copied
I kind of had a feeling that it wasn't possible, at least for security reasons if nothing else. I'll let my boss know. Thanks!
V/r,
^ _ ^