On Mon, Sep 21, 2009 at 1:38 AM, Shen <[email protected]> wrote:
>
> toolstrip.html
> ================================
> <script>
> function helloWorld()
> {
> var p = window.location.href;
> console.log(p);
> }
> </script>
>
> <div class="toolstrip-button" onclick="helloWorld();">
> <span>Get It!</span>
> </div>
>
> I want to retrieve current page's url with the "window.location.href"
> but I got some extension informations as below:
>
> chrome-extension://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaabi/my_toolstrip.html
>
> Does anyone have any suggestions or solutions? thanks.
Sure, remember that the toolstrip is an HTML page, so when you refer
to "window", you're referring to its window object, so this behavior
is expected. To get the URL of the currently select tab, you need to
use the tabs API:
chrome.tabs.getSelected(null, function(tab) {
console.log(tab.url);
});
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---