Yes, you cannot use chrome.tabs.* API calls in content scripts. I guess you
are using it to get the URL of the page? If so, try and use location.href
instead.

In general, I guess you will gather the information through an
XMLHttpRequest, which would be a cross origin one - which you also cannot do
in content scripts.
So, just send a message to the background page with the URL (or take the URL
from the tab using the tabId property of the sender, or something like that)
and send a message back with the information to the content script, that
will show the information once it receives a message.

☆PhistucK


On Tue, Jan 19, 2010 at 02:13, mike <[email protected]> wrote:

> I'm developing an extension that gets information (via a third party
> API call) about the current url and displays it to the user. I was
> thinking the most efficient way of going about this would be to make
> my API calls on the current url from the content script but I get the
> above error message. I'm guessing I should just do it from the
> background page instead but I was wondering if someone could explain
> the way things are intended to be done in a situation like this.
>
> --
> 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.

Reply via email to