I want to provide simple web service and let anyone to embed it in any site using JavaScript.
The Service is to provide Visitor IP address for Static Websites or any one that wants to used JavaScript for showing IP address instead of Server-Side script.
my code is:
<div style="white-space:normal; display:inline-block;background-color:white">
Your IP Address is: <br><strong>
{ip}</strong><br>Country:{country}<br>
ISP:{isp}
</div>
I can use document.write()
and output this content, but I am not sure if its the best choose, or using another method like appendChild
to a parent element?
last note, should I enclose the script between window.onload()
?