Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Anyone Know any JavaScript

Author
Message
The Lone Programmer
21
Years of Service
User Offline
Joined: 29th Jan 2003
Location: California, USA
Posted: 13th Feb 2004 19:46
I was wondering...
Is it possible to have a JavaScript code that works with MSIE and grabs the IP. I know it works with NS and with SSI but cant get it with MSIE.

Get Back To Me

Smokie

Jeku
Moderator
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Vancouver, British Columbia, Canada
Posted: 13th Feb 2004 20:07
Took me 0.2 seconds to find with a search engine:

// This part gets the IP
var ip = '<!--#echo var="REMOTE_ADDR"-->';

// This part is for an alert box
alert("Your IP address is "+ip);

Try google--- it's a good tool. I typed "javascript get ip address" and all the results fit.


http://www.jeku.com/audio/
Ancient Chinese proverb: Man who runs behind car gets exhausted.
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 15th Feb 2004 16:33
But that's SSI by the looks of it, not Javascript

"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
Dazzag
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Cyprus
Posted: 15th Feb 2004 17:30
I've only done a small amount of Javascript a few years ago at work. Mainly VBScript these days (ASP etc).

Still, try this out. Was on Planet source code (my fave site).



Hope that comes out right.

Cheers

I am 99% probably lying in bed right now... so don't blame me for crappy typing
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 15th Feb 2004 18:29 Edited at: 15th Feb 2004 18:30
Lol, that only works in NS, not IE

You can only do it in netscape

However, I might have an idea...

"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
HZence
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 15th Feb 2004 18:30
And that would be?


Team EOD :: Programmer/Storyboard Assistant
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 15th Feb 2004 18:35
Wait a mo I'm seeing if it will work

"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 15th Feb 2004 18:39
It works!



Copy & paste that where you want the IP to appear.

"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 15th Feb 2004 18:42
As far as I know it is impossible to have javascript alone to get ip address with all browsers. I use a simple php script that works serverside and thus guarantees to work in all browsers.

Have a file called ip.php with followig in it



Then in any html file you can use following:



Boo!
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 15th Feb 2004 18:44
@David T

Great minds think alike!

I use this on various work websites and it works a treat.

Boo!
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 15th Feb 2004 19:31
Except my mind is 3 minutes ahead of yours!



"They misunderestimated us" - George Bush
"The box said 'Requires Windows 95 or better'. So I installed LINUX. "

Formerly David89.
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 16th Feb 2004 04:39 Edited at: 16th Feb 2004 04:41
Cant you use Javascript:javascript:alert(document.ip) or something? I know *nothing* about java so just ignore me if Im wrong The only thing I know a cent about is alert Thats it tho


We need help! Email us! join@eternaldestinyonline.com
Jeku
Moderator
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Vancouver, British Columbia, Canada
Posted: 16th Feb 2004 09:21
David T. - I don't think that's SSI, or whatever you call it. I got it off a JavaScript reference page, and I used to use that on my own websites.


http://www.jeku.com/audio/
Ancient Chinese proverb: Man who runs behind car gets exhausted.
mm0zct
20
Years of Service
User Offline
Joined: 18th Nov 2003
Location: scotland-uk
Posted: 20th Feb 2004 00:40
i don't know any java script for getting ip's i use php for stuff like that. sorry i can't help. i can give you the php code for the items on my sit if you want though, ie. the counters and news page (which i both coded myself).

http://www.larinar.tk
AMD athlon thoroughbred 2200, 512Mb ram, 40Gb HD, ati saphire radeon 9600 atlantis w/128mb ddr ram, good creative-labs soundcard, cd-rw + dvd drives.
comando 300
20
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 20th Feb 2004 04:09 Edited at: 20th Feb 2004 04:11
http://www.w3schools.com/default.asp

There you can learn javascript,VBscript,HTML,DHTML,XML and more...

It's a good web site to learn all that languages

CURRENT PROJECT: RETRO PAC-MAN

Login to post a reply

Server time is: 2024-09-21 09:43:45
Your offset time is: 2024-09-21 09:43:45