views:

574

answers:

2

I'm writing a Firefox extension and I need to find the ip address of the currently loaded page. I can get the hostname of the page with window.location.host, but is there any way to find the ip for that hostname?

I tried looking for the answer at the Mozilla Developer Center but was unable to find anything.

EDIT: I would use something like PHP to do this, but cannot, because it's a firefox extension, running on the client side only. I have no web server to do back end PHP.

A: 

If not a PHP Lookup, do a simple nslookup, or dig for hostname string.

Vivek Sharma
is there a cross platform way to do an nslookup from a firefox extension?
mishac
Cross-platform (u mean various desktops, not iphone/symbian et al) nslookup is available in linux/windows, and i think must be available in mac too
Vivek Sharma
I mean cross platform meaning *from javascript* in a firefox extension, on any platform firefox runs on.
mishac
+3  A: 

You could look at how the ShowIP Firefox extension does it.

Jason Creighton
This led me in the right direction, to the "nsIDNSService" component. Thanks a lot!
mishac