【发布时间】:2015-07-09 16:21:59
【问题描述】:
我想在 javascript 中获取我的机器的 IP 地址,这将在我的 html 页面中进一步参考。 我已经参考了所有建议的链接,但我没有得到任何答案。 我不想使用任何链接来获取 IP,所以我尝试在我的 javascript 中使用以下代码行
var ip = '<%=request.getRemoteAddr();%>';
或
var ip = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
var ip = Request.UserHostAddress.ToString();
但没有得到结果。
请帮助我获得解决方案。我想在我的 html 页面中包含这个 javascript,我不想使用任何链接来获取 IP。
All the links I have gone through gives the external links to get the IP address and I do not want to use any external link to get the IP.
【问题讨论】:
-
@ Kishor Pawar 我在我的问题中提到我不想使用任何链接来获取 IP 地址。我已经浏览了这些链接
-
@Danny Sir,我已经试过了
-
@rachana 你在使用 JSP 吗?
标签: java javascript html ip