Quote:
Originally Posted by Harvey Specter
Something like this should work..
Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" >
var backup = document.write;
var ipaddress = "";
document.write = function(str) {ipaddress += str;};
</script>
<script type="text/javascript" src="(cant post links)://l2.io/ip.js"> </script>
<script type="text/javascript" >
document.write = backup;
function setIP(){
document.getElementById('formIPaddress').value = ipaddress;
}
</script>
</head>
<body onload="setIP();">
<form id="formName" name="formName">
<input type="hidden" name="formIPaddress" id="formIPaddress" />
</form>
</body>
</html>
|
Thanks a lot! They have a limitation in that the HTML code they need this done in is self-contained, i.e. no access to the head or the body tag (similar to if you had to do this entirely through a Wordpress widget that only recognized HTML/Javascript/etc. and not PHP). This is due to this being a hosted page and the system it's created through.
I think if needbe they may be able to switch to a page that can be fully coded. Though in that case, I believe PHP can be used. So I was more trying to see if there was a solution workable within those limitations since changing to a fully coded page AFAIK means changing the URL of the page which presents a whole other set of other things to fix within their order flow. Could this be made workable somehow in the scenario I mentioned?
It felt like there should be a way - using the Javascript code I mentioned in their system did return the IP, so it's just a matter of somehow getting that into the value of a form input.