I need to identify if a request comes from Internet or Intranet using either client-side or server-side.
The problem I\'m trying to solve is: our web site can be accesse
You can check the ip address of a user. Private ip4 address always start with either 10., or 172., or 192.* ... more info on private networks here.
You can also make Google Analytics load Asynchronous.
***************** UPDATE - PLEASE READ *************************************
As @igor-turman has correctly pointed out, that only a portion of the "172" and the "192" address ranges are designated for private use. The remaining ip addresses starting with 172 and 192 ARE PUBLIC.
Here is the regex expression to check for private IP addresses:
(^192\.168\.([0-9]|[0-9][0-9]|[0-2][0-5][0-5])\.([0-9]|[0-9][0-9]|[0-2][0-5][0-5])$)|(^172\.([1][6-9]|[2][0-9]|[3][0-1])\.([0-9]|[0-9][0-9]|[0-2][0-5][0-5])\.([0-9]|[0-9][0-9]|[0-2][0-5][0-5])$)|(^10\.([0-9]|[0-9][0-9]|[0-2][0-5][0-5])\.([0-9]|[0-9][0-9]|[0-2][0-5][0-5])\.([0-9]|[0-9][0-9]|[0-2][0-5][0-5])$)
You can test this regex on regexpal.com here.