Online Shopping : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

31 of 87 people (36%) answered Yes
Recently 5 of 10 people (50%) answered Yes

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?

Feb 24th, 2009 23:18
haytham ali, 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.forums.msryat.org
http://www.msryat.org
http://www.dir.msryat.org
http://www.games.msryat.org
http://www.3lmbnat.com
http://www.dir.3lmbnat.com
http://www.vb.3lmbnat.com
http://www.qtryat.com
http://www.qtryat.com/vb
http://forums.msryat.org/forumdisplay.php?f=2
http://forums.msryat.org/forumdisplay.php?f=3
http://forums.msryat.org/forumdisplay.php?f=84
http://forums.msryat.org/forumdisplay.php?f=4
http://forums.msryat.org/forumdisplay.php?f=118
http://forums.msryat.org/forumdisplay.php?f=44
http://forums.msryat.org/forumdisplay.php?f=69
http://forums.msryat.org/forumdisplay.php?f=85
http://forums.msryat.org/forumdisplay.php?f=91
http://forums.msryat.org/forumdisplay.php?f=70
http://forums.msryat.org/forumdisplay.php?f=73
http://forums.msryat.org/forumdisplay.php?f=57
http://forums.msryat.org/forumdisplay.php?f=6
http://forums.msryat.org/forumdisplay.php?f=7
http://forums.msryat.org/forumdisplay.php?f=61
http://forums.msryat.org/forumdisplay.php?f=68
http://forums.msryat.org/forumdisplay.php?f=92
http://forums.msryat.org/forumdisplay.php?f=101
http://forums.msryat.org/forumdisplay.php?f=10
http://forums.msryat.org/forumdisplay.php?f=11
http://forums.msryat.org/forumdisplay.php?f=43
http://forums.msryat.org/forumdisplay.php?f=51
http://forums.msryat.org/forumdisplay.php?f=81
http://forums.msryat.org/forumdisplay.php?f=80
http://forums.msryat.org/forumdisplay.php?f=14
http://forums.msryat.org/forumdisplay.php?f=15
http://forums.msryat.org/forumdisplay.php?f=16
http://forums.msryat.org/forumdisplay.php?f=87
http://forums.msryat.org/forumdisplay.php?f=18
http://forums.msryat.org/forumdisplay.php?f=50
http://forums.msryat.org/forumdisplay.php?f=90
http://forums.msryat.org/forumdisplay.php?f=89
http://forums.msryat.org/forumdisplay.php?f=95
http://forums.msryat.org/forumdisplay.php?f=102
http://forums.msryat.org/forumdisplay.php?f=19
http://forums.msryat.org/forumdisplay.php?f=20
http://forums.msryat.org/forumdisplay.php?f=21
http://forums.msryat.org/forumdisplay.php?f=71
http://forums.msryat.org/forumdisplay.php?f=96
http://forums.msryat.org/forumdisplay.php?f=98
http://forums.msryat.org/forumdisplay.php?f=97
http://forums.msryat.org/forumdisplay.php?f=99
http://forums.msryat.org/forumdisplay.php?f=100
http://forums.msryat.org/forumdisplay.php?f=52
http://forums.msryat.org/forumdisplay.php?f=66
http://forums.msryat.org/forumdisplay.php?f=23
http://forums.msryat.org/forumdisplay.php?f=24
http://forums.msryat.org/forumdisplay.php?f=25
http://forums.msryat.org/forumdisplay.php?f=26
http://forums.msryat.org/forumdisplay.php?f=62
http://forums.msryat.org/forumdisplay.php?f=63
http://forums.msryat.org/forumdisplay.php?f=65
http://forums.msryat.org/forumdisplay.php?f=64
http://forums.msryat.org/forumdisplay.php?f=47
http://forums.msryat.org/forumdisplay.php?f=67
http://forums.msryat.org/forumdisplay.php?f=48
http://forums.msryat.org/forumdisplay.php?f=29
http://forums.msryat.org/forumdisplay.php?f=86
http://forums.msryat.org/forumdisplay.php?f=49
http://forums.msryat.org/forumdisplay.php?f=30
http://forums.msryat.org/forumdisplay.php?f=31
http://forums.msryat.org/forumdisplay.php?f=88
http://forums.msryat.org/forumdisplay.php?f=32
http://forums.msryat.org/forumdisplay.php?f=33
http://forums.msryat.org/forumdisplay.php?f=78
http://forums.msryat.org/forumdisplay.php?f=34
http://forums.msryat.org/forumdisplay.php?f=103
http://forums.msryat.org/forumdisplay.php?f=109
http://forums.msryat.org/forumdisplay.php?f=104
http://forums.msryat.org/forumdisplay.php?f=105
http://forums.msryat.org/forumdisplay.php?f=106
http://forums.msryat.org/forumdisplay.php?f=108
http://forums.msryat.org/forumdisplay.php?f=110
http://forums.msryat.org/forumdisplay.php?f=111
http://forums.msryat.org/forumdisplay.php?f=112
http://forums.msryat.org/forumdisplay.php?f=113
http://forums.msryat.org/forumdisplay.php?f=114
http://forums.msryat.org/forumdisplay.php?f=115
http://forums.msryat.org/forumdisplay.php?f=116
http://forums.msryat.org/forumdisplay.php?f=117
http://forums.msryat.org/forumdisplay.php?f=36
http://forums.msryat.org/forumdisplay.php?f=37
http://forums.msryat.org/forumdisplay.php?f=72
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