+ Start a Discussion
AmulAmul 

IP Address of Client

How can we extract IP Address of client, who visited our Sites. And This Site is basically developed using VF Page and Controller class. ?

I needed to have information of client machine like, IP Address /IE version/Windows-OS etc.

Please suggest How can I get such information of visitors.

Is there any API calling or what idea behind this?

Like in VB Script or any Scripting Page we can easily get Client IP Address.

TrueCloudTrueCloud

Hi Amul,

 

You can use simple JavaScript to get the IP Address of the client computer. You can use the same to not only retrieve but store it to the database. 

 

For example

<apex:Page>

<script language = "Javascript">

 

// This part gets the IP
var ip = '<!--#echo var="REMOTE_ADDR"-->';
// This part is for an alert box
alert("Your IP address is "+ip);

 

// This part gets the IPvar ip = '<!--#echo var="REMOTE_ADDR"-->';
// This part is for an alert ("Your IP address is "+ip);

</script>

 

You can use Ajax to store the IP address in Salesforce objects. Let me know if this helps.

 

Also please mark this as a solution if this resolves your issue.

lescclarkcpdlescclarkcpd

Hi

 

I tried this, it works but ip address comes up as ******************

 

any suggestions

 

thanks