Yes, that effect is true, AFAIK every extension runs in its own isolated
world which contains its own html/js. So once you click on the browser
action icon, you should use the chrome API to get the URL of
the visited tab. To do so, you can use
http://code.google.com/chrome/extensions/browserAction.html#event-onClicked for
example in your background.html page, you can do the following:

chrome.browserAction.onClicked.addListener(function(tab) {
  console.log("URL: " + tab.url);
});


On Tue, Dec 8, 2009 at 11:57 PM, Daniel Khuong <dani...@gmail.com> wrote:

> I'm doing that right now and it returns the path to my test file instead of
> the url of the page I'm currently viewing.
>
> For example, if I'm on the page of www.amazon.com, and I click on my
> browser action icon, with this line of code:
> document.writeln(window.location);
>
> I get this return value, instead of 'www.amazon.com':
> chrome-extension://gfaicebfdaponcbjcedgbjiicfgplkef/test.html
>
> Thanks.
>
> On Tue, Dec 8, 2009 at 8:47 PM, Mohamed Mansour <m...@chromium.org> wrote:
>
>> Without content scripts, can't you just do?
>> javascript:alert(window.location)
>>
>> Unless you mean the URL of the current extension:
>> http://code.google.com/chrome/extensions/extension.html#method-getURL
>>  <http://code.google.com/chrome/extensions/extension.html#method-getURL>
>>
>> On Tue, Dec 8, 2009 at 11:19 PM, dk_man <dani...@gmail.com> wrote:
>>
>>> As a newbie to Chrome extension development, I'm curious to know if
>>> there is a way to access the properties of the current document being
>>> viewed without the need to create contents scripts. For example, if I
>>> want my extension to access the location of the document that is
>>> currently being viewed, I can use 'content.document.location' for
>>> Mozilla, but is there an equivalent way to access this property in
>>> Chrome?
>>>
>>> If not, what is the recommended way to do so to ensure that the
>>> extension will have access to such values?
>>>
>>> --
>>>
>>> You received this message because you are subscribed to the Google Groups
>>> "Chromium-extensions" group.
>>> To post to this group, send email to
>>> chromium-extensi...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> chromium-extensions+unsubscr...@googlegroups.com<chromium-extensions%2bunsubscr...@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/chromium-extensions?hl=en.
>>>
>>>
>>>
>>
>>
>> --
>>  - Mohamed Mansour
>>
>
>


-- 
 - Mohamed Mansour

--

You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to chromium-extensi...@googlegroups.com.
To unsubscribe from this group, send email to 
chromium-extensions+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to