1

Opening a connection to the server for this is acceptable, but I need to get the netmask used to connect to a web server. What I hope to accomplish with this is use the ipv6 netmask to group entries originating from the same subnet in my database and use them for some statistics.

Ok, please don't tell me to get from SERVER side, yes I can get the IP but I also want the NETMASK and I can't get that from the server side, I need the CLIENT's netmask.

xception
  • 4,241
  • 1
  • 17
  • 27

2 Answers2

2

It is impossible to get most things like that using JavaScript. You can get some some details though using server side (either your server or external)

For example: http://jsonip.appspot.com

<script type="application/javascript">
function getip(json){
  alert(json.ip);
}
</script>

<script type="application/javascript" src="http://jsonip.appspot.com/?callback=getip"> </script>
472084
  • 17,666
  • 10
  • 63
  • 81
  • I voted up your answer for now, I'll wait a few more days in hopes someone comes up with a solution to my issue, if not I will accept your answer as being impossible. I was hoping there was a way though. If this remains like this I will have to eventually have to talk with the client for which this project is about dropping storing ip addresses since a user with bad intentions might use his entire ipv6 subnet to fill my database with single address entries and slow down database queries very much. – xception Oct 11 '12 at 14:08
1

Just make an AJAX request to the server where the server just returns the address of the incoming connection as its data.

PhonicUK
  • 13,486
  • 4
  • 43
  • 62
  • Thanks for the effort but I really want the netmask as well. I would have thought with all the new stuff added recently in javascript there might be a way to open some socket and get the information I want somehow. – xception Oct 11 '12 at 13:48