views:

40

answers:

1

Hi friends,

i was just curious as how to do this.

i want to open www.whatsmyip.com or something similar from my webpage.

put an ip address in the textbox in that page.

click the button

and read the value(suppose a textbox)..

i want to achieve all this programtically without any humaninteraction..

how is that possible.

+2  A: 

The example you posted is not possible.

You can't read the contents of a frame from another domain(though a subdomain or on the same domain is possible), this is a restriction known as the same-origin policy, put in place for security reasons.

What If I could launch gmail.com and read your login name, what about your online banking site? :) You can see how this would be quickly abused if allowed.

Nick Craver
You've practically singlehandedly exhausted my supply of upvotes for today.
BradBrening
@Nick:Thanks for info.i never knew abt same origin policy..but we can write some covert scripts to simulate the events..i sound like a freak.but i wud try out writing some scripts to simulate :).thnx
sajad
@sajad - You mean get the IP from javascript? No that isn't possible, you can proxy content through your server or hit an external service using [JSONP](http://en.wikipedia.org/wiki/JSON#JSONP) though, but you can't get this informationg strictly from the client...nor would it be accurate with NAT and such, e.g. my local IP is not my external IP.
Nick Craver