How are you calling "window.location.hostname"? You could just use "tab.url" from the Tab object, and use JavaScript to parse out the hostname.
If you want to use "window.location.hostname", as far as I know, you would need Message Communication between your content script and your extension ( http://code.google.com/chrome/extensions/messaging.html) Your content script will return the window.location.hostname through a single request: chrome.extension.onRequest.addListener(function(request, sender, > sendResponse) { if (request.action == "getHostname") { sendResponse({hostname: window.location.hostname}); } else { sendResponse({}); // Send nothing.. } }); While your extension will be responsible informing the content script for the hostname: chrome.tabs.getSelected(null, function(tab) { // Send a request to the content script. chrome.tabs.sendRequest(tab.id, {action: "getHostname"}, > function(response) { console.log(response.hostname); }); }); Regarding fetching the IP of the website, I don't think you can do that in JavaScript, you would need an external service or a npapi plugin to do so. -Mohamed Mansour On Tue, Dec 22, 2009 at 6:45 PM, Doug @ Straw Dogs <[email protected]>wrote: > I'm trying to get the hostname and IP address of a currently viewed > page but location.hostname doesn't work and I don't know a way in JS > of getting the IP address of a page. > > Anybody got any ideas? > > -- > > You received this message because you are subscribed to the Google Groups > "Chromium-extensions" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<chromium-extensions%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/chromium-extensions?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Chromium-extensions" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/chromium-extensions?hl=en.
