function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

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.


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


<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);



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.




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


any suggestions