开发者

Get IP of domain with JavaScript [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

Can I lookup the IP address of a hostname from javascript?

Can you get the IP address of the current page where the script is running? I can get the current document's domain using var domain = document.domain;. In PhP you can get the IP address of a domain using开发者_开发知识库 the function gethostbyname($domain); is there an alternative to this function in JS?


Is there an alternative to this function in JS?

Not that I know of.

Your best best would be using Ajax to connect to a PHP or other server-side script that does the lookup for you.


Look here: How to find out the server ip address (using javascript) that the browser is connected to?

There's no way to do that in javascript, unless the site was acessed through an IP address, in that case you could look into the host.location property.


if you have knowledge of java applet then you can get IP on the client machine and you can populate the ip in your hidden field and utilize in your javascript

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜