简体   繁体   中英

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.

Is there any way to do this using only JavaScript, or will I need to use other tools to do so?

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:

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

You can get the geo location using geo location API . I don't think it is possible to get the ISP using JavaScript on the client.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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