views:

118

answers:

1

Hi, I'm trying to write a chrome extension that will take the URL of the page the user is on and send it to a server for a response back.

So far I have been trying to use 'chrome.tabs.getCurrent()', but I get uncaught TypeError on the getCurrent object.

Is there an easy way for doing this?

A: 

Any reason why you don't want to use getSelected()?

chrome.tabs.getSelected(windowId, function(tab) {
    alert("current:"+tab.url);
});
serg
For the same reason that getCurrent() doesn't work... I'm trying to get a chrome extension to grab the URL of the current page...
HatchiNZ
@HatchiNZ Maybe you are not calling it at the right place? Where do you put this code?
serg