I am afraid you won't be able to track IP address in HTML page.
As a workaround,you should create a hidden field which would stroe the IP addree using JS function in your HTML page and post it along with your web - to lead request.
So,you should be looking something like below :-
<script language="javascript">
var ip = '<!--#echo var="REMOTE_ADDR"-->'
function ipval() {
document.myform.ipaddr.value=ip;
}
window.onload=ipval
</script>
<form method="post" action="" name="myform">
<input type="hidden" name="ipaddr" readonly>
</form>
If this helps,please mark it as best answer to help others :)
<!-- ---------------------------------------------------------------------- --> <!-- NOTE: Please add the following <FORM> element to your page. --> <!-- ---------------------------------------------------------------------- -->
As a workaround,you should create a hidden field which would stroe the IP addree using JS function in your HTML page and post it along with your web - to lead request.
So,you should be looking something like below :-
If this helps,please mark it as best answer to help others :)
Thank you for suggestion.but the script is not executing when the form is load.
any suggestions..?
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
<!-- ---------------------------------------------------------------------- -->
<!-- NOTE: Please add the following <FORM> element to your page. -->
<!-- ---------------------------------------------------------------------- -->
<script language="javascript" type="text/javascript">
function ipval() {
alert("ippp");
var ip = '<!--#echo var="REMOTE_ADDR"-->'
document.myform.ipaddr.value=ip;
}
window.onload=ipval;
</script>
<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST" name="myform">
<input id="ipaddr" maxlength="255" name="ipaddr" size="20" type="hidden" /><br>
<input type="submit" name="submit">
</form>