Entry
how can i have the IP,REMOTE_ADDR, HTTP_USER_AGENT, SERVER_PROTOCOL etc... of the internetsurfer that visit my homepage and show it in a webpage?
Apr 4th, 2008 19:43
ha mo, Colin Fraser, paolo tonelli,
When I put the original answer to this question it was not tested and
there were errors in it, here is a revamped answer and this one works.
At least, it works in my browser, on my computer.
In your first document, place a link to this page eg.
<a href="visitor.html">Who are you? </a>
<html>
<head>
<title>Who you are </title>
</head>
<body>
<SCRIPT LANGUAGE="javascript">
// This script prompts for information and places it upon the page
var username = prompt ("Please enter your name in the prompt","Place it
here, thank you");
document.write("Hello <font size=+1>" + username + "</font>. Welcome to
my page!<p>");
</SCRIPT>
<SCRIPT LANGUAGE="javascript">
document.write("The browser you are using is <b>" +navigator.appName+
"</b>, version " +navigator.appVersion+ ".<br>Its code name is
"+navigator.appCodeName+ ", and sends the header " +navigator.userAgent+
"." );
</SCRIPT>
<p>
The object used here is "navigator", you may want to go and have a look
at the properties of JavaScript Objects in Netscape's developer site at
http://developer.netscape.com/docs/manuals/javascript.html
<p>
Netscape provides a couple of PDF documents detailing objects and their
properties as well as how to refer to them. Well worth the look. </p>
<SCRIPT LANGUAGE="javascript">
document.write("The background colour of this page is <b>"
+document.bgColor+ "</b>.")
document.write("<br>The text colour of this page is <b>"
+document.fgColor+ "</b>.")
document.write("<br>The URL of this page is <b>" +document.location+
"</b>.")
document.write("<br>The last page you visited was <b>"
+document.referrer+ "</b>.")
document.write("You visited " +history.length+ " pages before this one
in this session.")
document.write("<br>The TITLE of this page is <b>" +document.title+
"</b>.")
document.write("<br>The document was last modified: <b>"
+document.lastModified+ "</b>.")
document.write("The name of this location is <b>" + location.hostname +
"</b>.")
</SCRIPT>
<p>
</body>
</html>
Privacy issues cloud access to the name and url of the last page
visited, I suspect a lot of people would be unhappy at your accessing
their history object and displaying it to screen. The location is
determined by the server, so if you are using this from a hard drive it
is not going to work The URL of the page is not the location of the
visitor's server. Make sure the only breaks in the lines are those where
a line automatically wraps or where a new command begins a new line.
There is some information that you may not be able to display in you
visitor's browser.
I hope this answers your question better than my previous attempt did.
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com