简体   繁体   English

您可以使用JavaScript检测用户的ISP提供商吗?

[英]Can you detect a user's ISP provider with JavaScript?

I have static webpage. 我有静态网页。 In that page I want to get the ISP provider & location of a user, using JavaScript. 在该页面中,我想使用JavaScript获取ISP提供商和用户位置。

Is there any way to do this using only JavaScript, or will I need to use other tools to do so? 有什么方法可以仅使用JavaScript来执行此操作,还是需要使用其他工具来执行此操作?

It's not possible to detect the ISP provider using only JavaScript, if you would be willing to use PHP however, it's very simple: 这是不可能使用只有 JavaScript来检测ISP供应商,如果你愿意然而,使用PHP,这是非常简单的:

<?php 
  $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); 
  echo $hostname; 
?>

You can get the geo location using geo location API . 您可以使用地理位置API获取地理位置。 I don't think it is possible to get the ISP using JavaScript on the client. 我认为不可能在客户端上使用JavaScript来获得ISP。

您可以通过Get http请求调用http://ip-api.com/json ,响应是包含用户IP数据(包括“ isp”)的json

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM